🧪 🚀 Allow uploading files with different URLs
-
Enhanced components to perform the upload operation with a different urls for each ExtFile.
- ExtFile: Added a new property in ExtFile type:
uploadUrl
. - <Dropzone/> & <FileInputButton/>: There is a new sub-prop
uploadConfig.customUrl()
that is a fucntion that given an extFile object, obtains a custom url.
- ExtFile: Added a new property in ExtFile type:
-
The order of priority is as follows:
-
- ExtFile.uploadUrl
-
- DropzoneProps.UploadConfig.customUrl
-
- DropzoneProps.UploadConfig.url
-
-
The setup can be as follows:
...
return(
<React.Fragment>
<Dropzone
uploadConfig={
customUrl: (extFile)=> "https://urlfromserver/" + extFile.name
}
/>
<FileInputButton
uploadConfig={
customUrl: (extFile)=> "https://urlfromserver/" + extFile.name
}
/>
<Dropzone
onChange={updateFiles}
value={files}
>
{files.map((file) => (
<FileMosaic key={file.id} {...file} uploadUrl={"https://urlfromserver/" + extFile.id}/>
))}
</Dropzone>
</React.Fragment>
)