How to prevent ng2FileDrop for multiple file drop in area? #1133

Open
opened 2019-12-10 16:10:59 +00:00 by ypkkhatri · 4 comments
ypkkhatri commented 2019-12-10 16:10:59 +00:00 (Migrated from github.com)

Hi,

I'm trying to prevent the multiple file drop in ng2FileDrop, but I couldn't found any way to achieve this approach.

Is this possible in library?

Regards,

Yougesh

Hi, I'm trying to prevent the multiple file drop in `ng2FileDrop`, but I couldn't found any way to achieve this approach. Is this possible in library? Regards, Yougesh
vishnu-dev commented 2020-01-10 06:41:19 +00:00 (Migrated from github.com)

Have the ng2FileDrop as label to an input fileupload which is hidden. @ypkkhatri

    <label for="uploader-input" ng2FileDrop
           [ngClass]="{'over-drop-zone': hasBaseDropZoneOver}"
           (onFileDrop)="onFileDrop($event)"
           (fileOver)="fileOverBase($event)" [uploader]="uploader">
      {{hasBaseDropZoneOver ? 'Drop it!' : 'Drag and Drop or click to add file!'}}
    </label>
    <input type="file"
           ng2FileSelect
           [multiple]="false"
           [uploader]="uploader"
           (onFileSelected)="onFileDrop($event)"
           id="uploader-input" style="display:none"/>
Have the ng2FileDrop as label to an input fileupload which is hidden. @ypkkhatri ``` <label for="uploader-input" ng2FileDrop [ngClass]="{'over-drop-zone': hasBaseDropZoneOver}" (onFileDrop)="onFileDrop($event)" (fileOver)="fileOverBase($event)" [uploader]="uploader"> {{hasBaseDropZoneOver ? 'Drop it!' : 'Drag and Drop or click to add file!'}} </label> <input type="file" ng2FileSelect [multiple]="false" [uploader]="uploader" (onFileSelected)="onFileDrop($event)" id="uploader-input" style="display:none"/> ```
Kedar7 commented 2021-02-01 11:40:32 +00:00 (Migrated from github.com)

I tried the above snippet @vishnu-dev , still it doesn't work, if the user selects multiple file and drop it , it should not allow to drop, only single file should be allowed. How do I achieve this ?

I tried the above snippet @vishnu-dev , still it doesn't work, if the user selects multiple file and drop it , it should not allow to drop, only single file should be allowed. How do I achieve this ?
silnose commented 2021-02-17 19:24:04 +00:00 (Migrated from github.com)

updates?

updates?
Kedar7 commented 2021-02-18 03:28:07 +00:00 (Migrated from github.com)

I created a check '' if more than one file found then alert the user" or select the first file only.

I created a check '' if more than one file found then alert the user" or select the first file only.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#1133