ng2-file-upload icon indicating copy to clipboard operation
ng2-file-upload copied to clipboard

How to prevent ng2FileDrop for multiple file drop in area?

Open ypkkhatri opened this issue 5 years ago • 4 comments
trafficstars

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

ypkkhatri avatar Dec 10 '19 16:12 ypkkhatri

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"/>

vishnu-dev avatar Jan 10 '20 06:01 vishnu-dev

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 ?

Kedar7 avatar Feb 01 '21 11:02 Kedar7

updates?

silnose avatar Feb 17 '21 19:02 silnose

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

Kedar7 avatar Feb 18 '21 03:02 Kedar7