i am facing issue with displaying svg image in my react-file-pond library.
is there any configuration issue ?
waiting for reply thanks.
https://pqina.nl/filepond/docs/getting-started/installation/react/
here what i m trying to do:
“`<FilePond
allowMultiple={true}
maxFiles={maxFilesLimit}
server={{
process: (
fieldName,
file,
metadata,
load,
error,
progress,
abort
) => {
const formData = new FormData();
formData.append(fieldName, file, file.name);
formData.append(“uploadPath”, path || “”);
const xhr = new XMLHttpRequest();
xhr.open("POST", "/api/wasabi");
xhr.upload.onprogress = (e) => {
// progress(e.lengthComputable, e.loaded, e.total);
const percentCompleted = Math.round((e.loaded / e.total) * 100);
setCurrentFileUploadInProgress(file.name);
handleUploadProgress(
file.name,
percentCompleted === 100 ? 95 : percentCompleted
);
};
xhr.onload = function () {
const serverResponse = JSON.parse(xhr.responseText);
onUpload(serverResponse?.url || serverResponse);
load(serverResponse);
};
xhr.send(formData);
return {
abort: () => {
xhr.abort();
// setUploadProgress();
},
};
},
// revert: (uniqueFileId, load, error) => {
// // uniqueFileId is the ID of the file we are reverting
// console.log("Reverting file with ID:", uniqueFileId);
// load();
// },
}}
// ** FilePond options on edit
// files={imageLinks?.map((link) => ({
// source: link,
// options: {
// type: "limbo",
// },
// }))}
onprocessfilerevert={(file) => onRemove && onRemove(file.filename)}
maxFileSize={`${sizeLimit}mb`}
acceptedFileTypes={allowedExtensions}
onprocessfile={(error, file) => {
onUploadDone && onUploadDone();
handleUploadProgress(file.filename, 100);
}}
onaddfile={(error, file) => {
handleUploadProgress(file.filename, 0);
handleUploadProgress(file.filename, 50);
}}
// ** uncomment when needs validation in filepond
// onupdatefiles={handleFileLoad}
// onremovefile={(file) => file && onRemove(JSON.stringify(file))}
name="files" /* sets the file input name, it's filepond by default */
labelIdle='Drag & Drop your files or <span class="filepond--label-action">Browse</span>'
className={"filepond"}
/>```
Ls Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.