Skip to content

v1.2.0 馃И 馃殌 Improve uploading

Latest
Compare
Choose a tag to compare
@JinSSJ3 JinSSJ3 released this 22 Jan 04:45
· 3 commits to master since this release
cf66ae5

馃И 馃殌 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.
  • The order of priority is as follows:

      1. ExtFile.uploadUrl
      1. DropzoneProps.UploadConfig.customUrl
      1. 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>
    )