Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Core,
Dashboard,
Instagram,
Dropbox,
GoogleDrive,
Url,
Webcam,
Tus,
Form
} from 'uppy'
// @ts-ignore
const isOnTravis = !!(process.env.TRAVIS && process.env.CI)
const TUS_ENDPOINT = `http://${isOnTravis ? 'companion.test' : 'localhost'}:1080/files/`
const uppy = Core({
debug: true,
meta: {
username: 'John',
license: 'Creative Commons'
}
})
.use(Dashboard, {
target: document.body,
trigger: '#pick-files',
metaFields: [
{ id: 'license', name: 'License', placeholder: 'specify license' },
{ id: 'caption', name: 'Caption', placeholder: 'add caption' }
],
showProgressDetails: true,
proudlyDisplayPoweredByUppy: true,
note: '2 files, images and video only'
componentDidMount() {
this.uppy = new Core({
debug: true,
autoProceed: false,
restrictions: {
maxFileSize: 6000000,
maxNumberOfFiles: 5,
minNumberOfFiles: 1,
allowedFileTypes: ["image/*"]
},
onBeforeFileAdded: (currentFile, files) => {
if (currentFile.type && currentFile.type.split("/")[0] === "image") {
return Promise.resolve();
}
return Promise.reject("Invalid file format. Please upload an image");
},
onBeforeUpload: files => {
if (Object.keys(files).length > 5) {