If a user tries to drag a folder into a file loader control to download it, I need to show the user an error message that can only be downloaded for files. The problem is that I could not distinguish the file from the folder.
One way I thought was to check the jQuery file type property. Suppose the file name is "test.txt", then the file type will return "text / plain". For a regular folder name, such as "TestFolder", the file type will be empty and its size will return 0. However, if the folder name included an extension of the type "TestFolder.txt", then the file type would return "text / plain".
So, I could check the file size and file size, but it will not work correctly for the folder name, for example "TestFolder.txt". Can someone suggest me a good solution to fix this using jQuery or other methods?
javascript jquery file-upload drag-and-drop
Rajiv
source share