3

I've made a simple drag and drop directive for file uploading, but my main concern is that i need to have IE8/9 support, so taking in account that FormData is not supported, how can i do a multiple file upload without using the FormData object?

Thanks in advance.

EDIT: What i'm trying do do is this:

$scope.uploadFile = function () {
      var upload = $http.post('awesomeFileThatWantsMultipleFilesUploaded.php',
                 angular.element(document.getElementsByClassName('droppable')).scope().files,
                 {withCredentials: true,
                  headers: {'Content-Type': undefined },
                  transformRequest: angular.identity})
           .success(function (response) {
               });

      return upload;
   }

But the problem is that when the browser doesn't have support for FormData, i initialize the files variable as array, and then i push each file to the variable. If the file is FormData, this works.

1
  • This module github.com/nervgh/angular-file-upload is good. It supports native HTML5 uploads using FormData, but degrades to a legacy iframe upload method for older browsers. Commented Sep 24, 2014 at 12:06

1 Answer 1

0

Don't make this by hand. Is rather messy and you will always have problems. You can use a polyfill for formdata, like moxie, for angular I use angular-file-upload there is even a way to upload to S3 from the browser (here)

If you want to do it by hand, check the code in those repositories and find some ideas

Sign up to request clarification or add additional context in comments.

2 Comments

Plupload doesn't have support for IE9, and moxie is based on it. angular-file-upload, as you can see here on line 89, also uses formData, which I want to avoid, because of the ie9 support.
github.com/danialfarid/angular-file-upload#-old-browsers yeah you need the html5 polyfill, check the problems to avoid issues with those browsers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.