Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
pskanawat opened this issue Sep 1, 2014 · 9 comments

Comments

@pskanawat
Copy link

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.

@danialfarid
Copy link
Owner

what version of the plugin and what file type?

@pskanawat
Copy link
Author

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
Copy link
Author

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.

@danialfarid
Copy link
Owner

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
2a6a624#diff-d41d8cd98f00b204e9800998ecf8427e

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

@pskanawat
Copy link
Author

thanks

danialfarid pushed a commit that referenced this issue Sep 14, 2014
@dduft
Copy link

dduft commented Aug 9, 2016

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

@danialfarid danialfarid reopened this Aug 23, 2016
@thapaprince
Copy link

thapaprince commented Feb 4, 2017

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 .

@stephengardner
Copy link

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

@sushilsingh95
Copy link

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants