Search code examples
jquery-file-upload

Expected json response by JQuery File Upload Basic plus UI when delete fails


When using the JQuery File Upload UI plugin, https://github.com/blueimp/jQuery-File-Upload, what is the expected json response when the delete button is clicked for an uploaded file and an error occurs during the delete on the server or the delete process is otherwise not successful.

The documentation on the project website indicates the following example as a delete response - https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#using-jquery-file-upload-ui-version-with-a-custom-server-side-upload-handler

{"files": [
{
"picture1.jpg": true
},
{
"picture2.jpg": true
}
]}

Returning a similar json response with false instead of true doesn't seem to have any difference.


Solution

  • It seems like the UI plugin doesn't do anything with the response so any json response is valid and will have the same effect whether the delete was successful or not - the item will be removed from the file list. You'd need to modify the jquery.fileupload-ui.js code in order to do something specific with an error response.

    What should I return in response to show error message on delete event for blueimp/jquery.file-upload-ui