Hello there,
I develop my own server with express and multer to handle upload of image.
I simply use this to handle image :
app.post('/upload', upload.single('file'), (req, res) => {
console.log(req.file.filename);
res.json(req.file);
})
and my uppy config is here :
const uppy = new Uppy({
debug: true,
autoProceed: false,
allowMultipleUploadBatches: false,
restrictions: {
maxNumberOfFiles: 1,
maxFileSize: 10000000,
allowedFileTypes: ['image/*'],
},
})
.use(Dashboard, {
inline: true,
target: '#drag-drop-area',
height: '26vw',
width: '26vw',
proudlyDisplayPoweredByUppy: false,
fontsize: '1.5vw',
})
.use(XHRUpload, {
endpoint: "/upload",
getResponseData (responseText) {
console.log(responseText);
}
})
But i get this error in the navigator each time I send a file :
caught TypeError: Cannot read properties of undefined (reading 'url') at XMLHttpRequest.<anonymous> (index.js:317:27) (
I supposed I need to send more information and not only the filename on the server but, have tried to send a lot of different data and nothing works.
Do you know how to fix it ?
Siryak