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

Dropping file in Chrome sets empty type to file object. (works well in Firefox)

Open pskanawat opened this issue 9 years ago • 9 comments

When user drops file in ng-file-drop area, it doesn't set type to file object. which is important property to identify type of file going to be uploaded.

pskanawat avatar Sep 01 '14 16:09 pskanawat

what version of the plugin and what file type?

danialfarid avatar Sep 01 '14 16:09 danialfarid

I was analysing the issue and got to know that the culprit code is in function "extractFiles". where we do check for "evt.dataTransfer.items". Chrome has this property with type being empty. Firefox doesn't have at all so it goes to else case where we create file object from "evt.dataTransfer.files".

I am not sure on these checks. please put in some thoughts.

pskanawat avatar Sep 01 '14 16:09 pskanawat

it's 1.6.5 and i tried with CSV, even you can check here as well http://angular-file-upload.appspot.com/

I just checked this issue is only happening with file type csv.

pskanawat avatar Sep 01 '14 16:09 pskanawat

This issue was fixed before #273 but since version 1.6.5 after fixing an issue with dropping multiple files including directories the issue is reintroduced https://github.com/danialfarid/angular-file-upload/commit/2a6a624e940c1b74634c6b9015a5015c51935392#diff-d41d8cd98f00b204e9800998ecf8427e

For now use the versions prior to 1.6.5 and wait for the next release which will fix this issue.

danialfarid avatar Sep 01 '14 21:09 danialfarid

thanks

pskanawat avatar Sep 02 '14 06:09 pskanawat

Hi, found this in 12.0.4 again?! Any prior changes which could have affected this?

dduft avatar Aug 09 '16 14:08 dduft

Hi danialfarid my file is showing empty and not upload the image. this is my service function----> var upload = function (file) { var defer = $q.defer(); console.log(file); }; var fd = new FormData();

       fd.append('file', file);

        console.log(fd);
       
        webApiService.post("/upload", fd, {
            transformRequest: angular.identity,
            headers: {'Content-Type': undefined}

        }).success(function (response) {
            defer.resolve(response);

i have get data in file parameter but fd is showing blank and not post the image how to solve it .

thapaprince avatar Feb 04 '17 12:02 thapaprince

Been a year - I'm noticing this issue on types like .xlsx and .psd. Is this fixed?

stephengardner avatar Aug 08 '17 22:08 stephengardner

Hi @danialfarid, I am facing this issue in Chrome 81.0 and Firefox 76.0 with plugin version 12.2.13. On Uploading .xlsx file it sends the content-type as application/octet-stream.

sushilsingh95 avatar May 06 '20 09:05 sushilsingh95