[ad_1]
Im using Uppy XHR combined with Ajax (that interfaces with a PHP script) to upload files.
Now, I would like that Uppy consideres what happens in the php script, because even throwing a fatal error, it still turns out that the file was loaded correctly.
JQuery code
var uppy = new Uppy.Core()
.use(Uppy.Dashboard, {
inline: true,
target: '#drag-drop-area'
})
.use(Uppy.XHRUpload, {
method: 'post',
endpoint: SCRIPT_PATH
})
.on('file-added', (file) => {
uppy.setFileMeta(file.id, {
size: file.size,
id: id_product
})
})
.on('complete', (result) => {
console.log('Upload complete! We’ve uploaded these files:', result.successful);
console.log('failed files:', result.failed)
})
[ad_2]