Multiple file in queue if single file type is selected #1051

Open
opened 2018-09-05 12:09:13 +00:00 by praveen5exceptions · 3 comments
praveen5exceptions commented 2018-09-05 12:09:13 +00:00 (Migrated from github.com)

When i create single file type input and console the uploader object ( console.log(this.uploader.queue) ) it shows are previous selected file with new file. is there any way to select only one file and refresh or reset the queue to hold on last selected file?

When i create single file type input and console the uploader object ( console.log(this.uploader.queue) ) it shows are previous selected file with new file. is there any way to select only one file and refresh or reset the queue to hold on last selected file?
sebastian-zarzycki-apzumi commented 2018-11-07 14:35:46 +00:00 (Migrated from github.com)

Same here. And limiting queue size to 1 in options makes it only accept first file choice. Later choices are ignored.

Same here. And limiting queue size to 1 in options makes it only accept first file choice. Later choices are ignored.
jasonvuriker commented 2018-12-04 07:10:58 +00:00 (Migrated from github.com)

I think it helps. I couldn't find another way to solve this)

   <input type="file" ng2FileSelect
            [uploader]="uploader" accept="image/*" (click)="clearQueue()" />


    clearQueue(){
        this.uploader.clearQueue();
    }
I think it helps. I couldn't find another way to solve this) ``` <input type="file" ng2FileSelect [uploader]="uploader" accept="image/*" (click)="clearQueue()" /> clearQueue(){ this.uploader.clearQueue(); } ```
pinoatrome commented 2019-01-19 12:55:24 +00:00 (Migrated from github.com)

Hi @jasonvuriker many thanks for you suggestion: it works greatly unless the user hits cancel instead of selecting a file: in this case the queue is reset (click) BUT not populated (cancel).

alternative approach: upload only the last item (if any) selected by the user.
To achieve this: let the user select multiple files (queueLimit unset in the configuration to avoid the issue stated by @sebastian-zarzycki-es ) BUT instead of uploadAll() use:

            const item = this.uploader.queue[this.uploader.queue.length-1];
            this.uploader.uploadItem(item);

HTH

Hi @jasonvuriker many thanks for you suggestion: it works greatly unless the user hits cancel instead of selecting a file: in this case the queue is reset (click) BUT not populated (cancel). alternative approach: upload only the last item (if any) selected by the user. To achieve this: let the user select multiple files (queueLimit unset in the configuration to avoid the issue stated by @sebastian-zarzycki-es ) BUT instead of uploadAll() use: ``` const item = this.uploader.queue[this.uploader.queue.length-1]; this.uploader.uploadItem(item); ``` HTH
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#1051