Comments (6)
Update: I noticed in your documentation about the files array that you're showing source
as a String despite the sample value clearly being an Integer. So, I added .toString()
to my own Integer-based source
and sure enough, this resolves the error.
That's obscure and fragile, especially since the documentation doesn't explicitly state something like "Note: source
must be a String value." If I may request, please either:
- Cast
source
to String when you load it so that the onus is not on your end-users to ensure that we do so. - Add a specific note like the above suggestion to ensure that readers of your documentation know to ensure
source
is a String.
Option 1 would be a better service to your end-users.
That said, the FilePond isn't behaving quite right despite the original error now resolved. Despite receiving the data it seems to need, the FilePond is showing only gray boxes with the Stringified source as a title and the file size as a subtitle on each box, each with an X button that seems to do nothing except remove the gray box from the control (it does not trigger a call to the back-end API).
I'll try to research this as a new issue...
from filepond.
Update on the follow-up issue: It turns out, Express' sendFile
function can't tell that file-extension jpeg
is the same as jpg
and should therefore be sent with a Content-Type header value of image/jpeg
; it was instead sending application/octet-stream
.
I had to modify my Node.js server to forcibly rename *.jpeg
uploads to *.jpg
. Doing so resolved the issue; FilePond now correctly loads and displays previously-uploaded images (with one caveat, below). This is IMHO entirely absurd on Express' part and fortunately, that issue has nothing to do with FilePond.
However, upon fixing that issue, another did arise: Upon (finally) successfully reloading previously uploaded images via FilePond, the FilePond component shows an X button on each image thumbnail. Clicking that button does nothing except remove the image preview from view without removing it from the API server; FilePond makes no effort to contact the back-end API server to signal deletion of the image. I expect clicking the X to trigger a delete event.
I will attempt to research this as a new issue...
from filepond.
Update on the issue of the X button failing to send a DELETE to the back-end API server: this behavior is evidently by design per the FilePond documentation. I have to say, I do not understand why.
While uploading files, when I click the X, it sends a DELETE signal. I therefore, reasonably, expect that clicking any X on a FilePond entry would invoke identical behavior. To do otherwise is a frustrating surprise.
For posterity, I resolved this discrepancy by adding the following to my FilePond instance:
, remove: (source, load, error) => {
const url = `${protectedResources.apiPartOrderPics.endpoint}/${source}`;
execute("DELETE", url)
.then(response => {
if (!response) {
return;
}
if (response.status === 204) {
console.log("ReceivingEntryCard: Deleted packing slip photo: ", response);
setPackingSlipPhotos(packingSlipPhotos.filter((file) => file.source !== source));
// If the last packing slip photo was deleted, set the error message to required
if (packingSlipPhotos.length === 1) {
// 1 (not 0) because React hasn't updated the file list yet
setPackingSlipPhotosError("required");
}
load();
return;
}
console.error("ReceivingEntryCard: API error deleting data:", response);
error("API error deleting data");
}).catch(err => {
console.error("ReceivingEntryCard: General error deleting data:", err);
error("General error deleting data");
});
}
from filepond.
Thanks for the detailed implementation story.
I've just pushed a fix for the "setting source with a number" issue. Past-Rik wrote this library 6 years ago, and I myself ran into it yesterday when testing something and it was quite confusing.
However, upon fixing that issue, another did arise: Upon (finally) successfully reloading previously uploaded images via FilePond, the FilePond component shows an X button on each image thumbnail. Clicking that button does nothing except remove the image preview from view without removing it from the API server; FilePond makes no effort to contact the back-end API server to signal deletion of the image. I expect clicking the X to trigger a delete event.
You'll have to implement the "remove" endpoint, see:
https://pqina.nl/filepond/docs/api/server/#remove
It's not implemented as allowing users to remove files from the server is a potential security risk.
from filepond.
Thanks for the detailed implementation story.
Happy to help!
I've just pushed a fix for the "setting source with a number" issue. Past-Rik wrote this library 6 years ago, and I myself ran into it yesterday when testing something and it was quite confusing.
Great! I'll pull down the update today and test it out.
However, upon fixing that issue, another did arise: Upon (finally) successfully reloading previously uploaded images via FilePond, the FilePond component shows an X button on each image thumbnail. Clicking that button does nothing except remove the image preview from view without removing it from the API server; FilePond makes no effort to contact the back-end API server to signal deletion of the image. I expect clicking the X to trigger a delete event.
You'll have to implement the "remove" endpoint, see:
https://pqina.nl/filepond/docs/api/server/#remove
It's not implemented as allowing users to remove files from the server is a potential security risk.
I do not understand this reasoning based on existing contradictory behavior of FilePond:
- Upon upload, the API must already issue a unique ID back to FilePond. This necessitates permanent artifacts on the server (filesystem and/or database). We API authors must necessarily already take precautions that the destructive operation is rendered secure.
- During the process/revert cycle, FilePond already emits a DELETE command to the API server whenever the user clicks the X button. This triggers the API to destroy the permanent artifacts (filesystem and/or database) which were created to respond to the initial upload.
- Merely loading the same files back into FilePond does not change the security implications of what the API server already had to handle to enable revert/DELETE during the upload/process mode.
- Every destructive operation carries with it the same security risks, no matter whether the user is (likely unknowingly) deleting a temp or permanent asset. It always falls on the API implementer to handle destructive operations with due care.
I don't understand the argument that one press of the X button is more/less "secure" than another. The same ID is transmitted between client and server, either way.
As illustrated above, I have added the additional code to handle pressing the X button after a load
. I had no choice but to expend the time to do so. I posit that it isn't any more/less secure than just letting FilePond send the DELETE command, sparing FilePond users the surprise and frustration of finding that the X button does nothing on its own.
This is incidentally academic at this point. I have FilePond behaving exactly as I need by writing the additional DELETE event handler. I only wanted to voice my journey in the hope that it might provide constructive feedback and, ideally, help make FilePond even easier to use for future projects and newcomers.
Above all else, I do want to say, "Thank you, so much for making FilePond!" Despite the loss of a few days to the original and subsequent issues, it is clear to me that your work did save me many countless days/weeks of implementing such a solution myself. For that, I am sincerely thankful to you.
from filepond.
Thanks for your input, I'll take it in consideration for FilePond v5
Above all else, I do want to say, "Thank you, so much for making FilePond!" Despite the loss of a few days to the original and subsequent issues, it is clear to me that your work did save me many countless days/weeks of implementing such a solution myself. For that, I am sincerely thankful to you.
I'm glad to hear that.
from filepond.
Related Issues (20)
- [Bug] Please remove the shaking animation.
- [Feature] Customize Animation Duration
- [Bug] [react-filepond] State update in onremovefile event handler triggers file re-upload HOT 2
- Converting Headers key to CamelCase? HOT 1
- Bootstrap 5 image preview as gallery [Feature] HOT 2
- [Feature] How to show file limits to a custom html area with a selector HOT 5
- filepond--list-scroller overlays other elements [Bug] HOT 1
- Display a custom message on Upload complete, including data from the server response HOT 3
- I'm not able to drag an attachment from Outlook or Gmail HOT 3
- [Bug?] HOT 1
- [Bug] typings missing processfiles event HOT 1
- Upload of a large file (100s Mb) restarted each time a response received from back-end HOT 3
- Foreign character failure - unescape(encodeURIComponent(options.headers[key])); [Bug] HOT 3
- Filepond not working HOT 2
- [Bug] Method 'onupdatefiles' doesn't recognize states updates HOT 1
- [Bug] Safari click on custom idleLabel prop requires 2 clicks to trigger file upload dialog
- how to handle custom error message on maxFilesLimit HOT 2
- [Feature] is it possible to create custom file preview HOT 5
- Accessing the transformed image HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filepond.