ng2-file-upload
ng2-file-upload copied to clipboard
How to prevent ng2FileDrop for multiple file drop in area?
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
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"/>
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 ?
updates?
I created a check '' if more than one file found then alert the user" or select the first file only.