Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload mutiple files bug! #77

Closed
mickeychu opened this issue Sep 7, 2016 · 4 comments
Closed

Upload mutiple files bug! #77

mickeychu opened this issue Sep 7, 2016 · 4 comments

Comments

@mickeychu
Copy link

Hi, I realized that there's a bug when uploading files.

Here's the use case:
I just want the user of my app to upload 1 file at a time. But, if I choose a file, not upload it then choose another one then click upload (I want to upload file manually by a button) So both files will be uploaded to the server. (So if I choose more and more, all files will be uploaded to the server.)

Here's my code:

ts:

 handleUpload(data): void {
    if (data && data.response) {
      data = JSON.parse(data.response);
    }
  }

  startUpload() {
    this.uploadEvents.emit('startUpload');
  }


html:

<input type="file" formControlName="upload" class="upload_input"
             ngFileSelect
             (onUpload)="handleUpload($event)"
             [events]="uploadEvents"
             [options]="options"
             (change)="get_name($event)">

I just want to upload the latest file that user choose, not all the files that they have chosen.

@jkuri
Copy link
Contributor

jkuri commented Sep 7, 2016

Hey,

I know, there's a problem with FileList API which is readonly.

@mickeychu
Copy link
Author

mickeychu commented Sep 7, 2016

@jkuri : so is there any manual way to fix this? Or at least just upload the latest chosen file?

@mickeychu
Copy link
Author

will this be fixed in the next release @jkuri ?

@palpa
Copy link
Contributor

palpa commented Sep 16, 2016

I'm also facing the same issue, I fixed it clearing the queue in addFilesToQueue method of ng2-uploader.ts service (pull request submitted)

palpa added a commit to palpa/ng2-uploader that referenced this issue Sep 16, 2016
palpa added a commit to palpa/ng2-uploader that referenced this issue Nov 21, 2016
jkuri pushed a commit that referenced this issue Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants