I have a simple uploader
with an onFileUploadError
handler.
I want to be able to display the error message in the response.
The docs say that the handler takes two parameters file and response[0]. It seems file
is a property of the first parameter.
The docs also say that the response needs to be "{ status:'error' }"
. The event seems to trigger for any response with a 400 status code.
No matter what I have tried response.status
is error
, even when I set it to client
.
How do you get the actual response data? I thought I could have a response like
{ status:'error', message: 'my error message' }
and a handler like
{
view: "uploader",
value: "Select File",
upload: shared.apiUrl + "/api/upload/",
formData: {},
// Submit the form when a file is selected
autosend: true,
on: {
onFileUpload: function(response){
webix.alert("File Uploaded.");
},
onFileUploadError: function(response){
webix.alert("Upload failed. " + response.message);
}
}
},
How do you display an error message from the server when uploading a file fails?
0: https://docs.webix.com/api__ui.uploader_onfileuploaderror_event.html