jQuery-File-Upload icon indicating copy to clipboard operation
jQuery-File-Upload copied to clipboard

with "folder selection" (multiple directory webkitdirectory mozdirectory) it lists also directory items...

Open ILSabbe opened this issue 11 years ago • 2 comments
trafficstars

When configuring the file input field with "multiple directory webkitdirectory mozdirectory"

when i choose a directory, that have some files inside, and a subdirectory with even other files, it lists correctly all the files, but shows the subdirectory too, with 0 kb size.

why it does not filter it?

Thanks for help!

image

image

ILSabbe avatar Feb 18 '14 09:02 ILSabbe

It seems that Chrome doesn't seem to populate the webkitEntries (or entries) property of the file input anymore on input onchange events: https://code.google.com/p/chromium/issues/detail?id=138987

Therefore all we have is a FileList, where we cannot detect if the given File object is a directory or a valid File. The list you get in your example is created by Chrome itself, so you might want to add your vote to the Chromium bug report or create a new one specific for this issue on the Chromium bug tracker.

If you never want to accept files with a file size of 0 you can also filter those from the list in your own application.

blueimp avatar Feb 18 '14 16:02 blueimp

yes... is what i've done indeed :) Anyway thanks a lot (again) for the reply :)

i added, inside jquery.fileupload.js, in the "_onAdd" object .... $.each(fileSet || files, function (index, element) {
if (element.size>0) { ....

:+1:

ILSabbe avatar Feb 18 '14 17:02 ILSabbe