I can modify the name of the file and it will show it in the console. How can I send this name to the server so the server can use the name? It shows in the console that the files have the updated names, but I cannot get it to send the updated names to the server in the request.
var uppy = new Uppy.Core({
autoProceed: true,
onBeforeFileAdded: (currentFile, files) => {
console.log(currentFile.data.lastModified);
datePhotoTaken = currentFile.data.lastModified;
// Change the file name to the last modified date. This doesn't seem to be coming through the XHR upload process unfortunately.
const modifiedFile = {
...currentFile,
name: currentFile.data.lastModified + ".jpg"
}
return modifiedFile
},
onBeforeUpload: (files) => {
console.log('updated files', files) // files here have `new-name` and empty `data`
},
restrictions: {
allowedFileTypes: ['image/*']
}
})
.use(Uppy.Dashboard, {
inline: true,
disableThumbnailGenerator: true,
showSelectedFiles: false,
target: '#drag-drop-area',
height: 250
})
.use(XHRUpload, {
endpoint: uploadUrl
fieldName: 'my_file',
limit: limit,
headers: {
'clientResize': clientResizeEnabled.toString()
}
})
uppy.on('complete', (result) => {
console.log('Upload complete! We’ve uploaded these files:', result.successful)
})