react-fine-uploader icon indicating copy to clipboard operation
react-fine-uploader copied to clipboard

Single file upload support

Open arvinsim opened this issue 8 years ago • 2 comments

I am trying to

const uploader = new FineUploaderTraditional({
  options: {
    request: {
      endpoint: '<redacted>',
      clockDrift: 500
    },
    validations: {
      itemLimit: 1
    },
    autoUpload: false
  }
})
<FileInput name={name} uploader={uploader} />
{fileId ? <Filename id={fileId} uploader={uploader} /> : null
uploader.on('onSubmitted', id => {
      // This method sets this.state.fileId
      setFileId(id)
})

I tried submitting 3 files. However there are problems with it

  • The <Filename /> code does not update the name of the latest file to be submitted
  • When running uploader.methods.uploadStoredFiles() when submitting, it list all the 3 files as stored, even if I sent the validations.itemLimit option to 1.

Do I have to manually clear stored files using uploader.methods.clearStoredFiles(). If yes, then where do I need to do this?

arvinsim avatar Oct 23 '17 08:10 arvinsim

The filename component was not designed with reuse in mind. You’ll need to update it such that the name is recompiled when the id changes.

rnicholus avatar Oct 26 '17 06:10 rnicholus

Ok got it.

Is there a way to restricting uploads to only one file? I know there is multiple attribute but will multiple=false work?

arvinsim avatar Nov 03 '17 07:11 arvinsim