react-fine-uploader
react-fine-uploader copied to clipboard
Single file upload support
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 thevalidations.itemLimitoption to 1.
Do I have to manually clear stored files using uploader.methods.clearStoredFiles(). If yes, then where do I need to do this?
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.
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?