Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Single file upload support #154

Open
arvinsim opened this issue Oct 23, 2017 · 2 comments
Open

Single file upload support #154

arvinsim opened this issue Oct 23, 2017 · 2 comments

Comments

@arvinsim
Copy link

arvinsim commented Oct 23, 2017

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?

@rnicholus
Copy link
Member

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.

@arvinsim
Copy link
Author

arvinsim commented Nov 3, 2017

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants