Created
July 25, 2022 20:41
-
-
Save warrenkc/c80538c4548218e027086c6dad2e2ecb to your computer and use it in GitHub Desktop.
Uppy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var uppy = new Uppy.Core({ | |
autoProceed: true, | |
restrictions: { | |
allowedFileTypes: ['image/*'] | |
}, | |
onBeforeFileAdded: (currentFile, files) => { | |
// Change the file name to the last modified date. This file name doesn't arrive at the server upload handler. | |
const modifiedFile = { | |
...currentFile, | |
name: currentFile.data.lastModified + ".jpg" | |
} | |
return modifiedFile | |
}, | |
}); | |
uppy.use(Uppy.Dashboard, { | |
inline: true, | |
disableThumbnailGenerator: true, | |
showSelectedFiles: false, | |
target: '#drag-drop-area', | |
height: 250 | |
}) | |
const { XHRUpload } = Uppy | |
uppy.use(XHRUpload, { | |
endpoint: uploadUrl | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment