Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Upload File in IE8/9 doesn't work #74

Closed
Capellaro opened this issue May 14, 2014 · 16 comments
Closed

Upload File in IE8/9 doesn't work #74

Capellaro opened this issue May 14, 2014 · 16 comments

Comments

@Capellaro
Copy link

Refering to #73.

I just tried the crossdomain.xml tip. But I am stuck on an error when accessing the server for the upload :
SCRIPT445: Object doesn't support this action xdomain.min.js, line 3 character 8458
Here is my upload function that make a call to my slave server :

$scope.onFileSelect = function($files) {
        //$files: an array of files selected, each file has name, size, and type.
        for (var i = 0; i < $files.length; i++) {
            var file = $files[i];
            $scope.upload = $upload.upload({
                url: SETTINGS.urlBackend+'/upload/add', //upload script
                method: 'POST',
                file: file
            }).progress(function(evt) {
                console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total));
            }).success(function(data, status, headers, config) {
                console.log(data);
                // file is uploaded successfully
                if(data.callback == 'success'){
                    $scope.addAlert("success", data.message);
                    $scope.photo = SETTINGS.urlBackend+'/images/tmp/'+data.fileName;
                }
            }).error(function(data) {
                if(data.callback == 'error'){
                    $scope.addAlert("warning", data.message);
                }
            });
        }
    };

I must say that I am testing on IE 9 but I think the problem will be the same on any IE <= 9

I am not 100% sure but it seems the error is happening on this line of xdomain.js _ref = req.headers; looking to the error code and line 8459 of xdomain.min.js above.

@Capellaro
Copy link
Author

My logs right before the error :

LOG: xdomain (http://accred-front.dev.test.ch): proxying request to slave: 'http://accred.dev.test.ch' 
LOG: xdomain (http://accred-front.dev.test.ch): new socket: xdomain-82bdce07 
LOG: xdomain (http://accred-front.dev.test.ch): receive socket: xdomain-82bdce07: 'ready' 
LOG: xdomain (http://accred-front.dev.test.ch): send socket: xdomain-82bdce07: request 
LOG: xdomain (http://accred-front.dev.test.ch): receive socket: xdomain-82bdce07: 'XD_CHECK': '[object Object]' 
LOG: xdomain (http://accred-front.dev.test.ch): send socket: xdomain-82bdce07: ready 
LOG: xdomain (http://accred-front.dev.test.ch): ready socket: xdomain-82bdce07 (emit #1 pending) 
SCRIPT445: Object doesn't support this action 
xdomain.min.js, line 3 character 8458

@jpillora
Copy link
Owner

Can you try with the non-min version?

On Wed, May 14, 2014 at 4:42 PM, AlexCapi [email protected] wrote:

My logs right before the error :

LOG: xdomain (http://accred-front.dev21.dev.infomaniak.ch): proxying request to slave: 'http://accred.dev21.dev.infomaniak.ch'
LOG: xdomain (http://accred-front.dev21.dev.infomaniak.ch): new socket: xdomain-82bdce07
LOG: xdomain (http://accred-front.dev21.dev.infomaniak.ch): receive socket: xdomain-82bdce07: 'ready'
LOG: xdomain (http://accred-front.dev21.dev.infomaniak.ch): send socket: xdomain-82bdce07: request
LOG: xdomain (http://accred-front.dev21.dev.infomaniak.ch): receive socket: xdomain-82bdce07: 'XD_CHECK': '[object Object]'
LOG: xdomain (http://accred-front.dev21.dev.infomaniak.ch): send socket: xdomain-82bdce07: ready
LOG: xdomain (http://accred-front.dev21.dev.infomaniak.ch): ready socket: xdomain-82bdce07 (emit #1 pending)
SCRIPT445: Object doesn't support this action
xdomain.min.js, line 3 character 8458


Reply to this email directly or view it on GitHubhttps://github.com//issues/74#issuecomment-43047361
.

@Capellaro
Copy link
Author

I just tried with :

<!DOCTYPE html>
<script src="http://jpillora.com/xdomain/dist/0.6/xdomain.js" master="*"></script>

But this is what I get then :

LOG: xdomain (http://accred-front.dev.test.ch): proxying request to slave: 'http://accred.dev21.dev.test.ch' 
LOG: xdomain (http://accred-front.dev.test.ch): new socket: xdomain-cc2c20d0 
LOG: xdomain (http://accred-front.dev.test.ch): receive socket: xdomain-cc2c20d0: 'ready' 
LOG: xdomain (http://accred-front.dev.test.ch): send socket: xdomain-cc2c20d0: request 
LOG: xdomain (http://accred-front.dev.test.ch): receive socket: xdomain-cc2c20d0: 'XD_CHECK': '[object Object]' 
LOG: xdomain (http://accred-front.dev.test.ch): send socket: xdomain-cc2c20d0: ready 
LOG: xdomain (http://accred-front.dev.test.ch): ready socket: xdomain-cc2c20d0 (emit #1 pending) 
SCRIPT445: Object doesn't support this action 
proxy.html, line 1 character 1

@jpillora
Copy link
Owner

Do you know if it will be possible to fix this error?

Possibly, though I can't say from those logs, could you make a demo of this? Or better, debug it and see which line is throwing "Object doesn't support this action"

@Capellaro
Copy link
Author

Well as I said in my first post, is it possible that the error come from that line : _ref = req.headers;as stated in the error log ?

@jpillora
Copy link
Owner

That must be IE's devtools failing, req.headers is just a plain object, you normally see "Object doesn't support this action" on things like forEach() defineProperty(). I think needs to be stepped through. I can have a look, though I'll need a running demo

@throrin19
Copy link

I have a problem for ie9 upload file :). sSince this subject is already open, I'll avoid opening another.

I used this jquery upload library : https://github.com/blueimp/jQuery-File-Upload

the request is correctly send except, yes this is the big problem, the file is does'nt send O_o. I think is again the xhr/xdomain problem because it works fine on chrome, ie10, firefox, ...

@jpillora
Copy link
Owner

so i mentioned this to @Alexcapi in an email, file upload using xmlhttprequest requires formdata, which isnt supported on ie8/9, all you can do is using a normal form fullpage submit.

@Alexcapi was trying to using a flash workaround, though i dont see how it'll be able to interact with xdomain if you use flash

@throrin19
Copy link

jquery-file-upload use iframe-transport plugin. I include that but now ie9 show me a download popup to get the server result O_o. But it's not your library in this case, it's jquery-file-upload

@jpillora
Copy link
Owner

yea so iframe transport wont work with xdomain either, xdomain only patches
the xmlhttprequest object

On Fri, May 23, 2014 at 11:33 PM, Benjamin Besse
[email protected]:

jquery-file-upload use iframe-transport plugin. I include that but now ie9
show me a download popup to get the server result O_o. But it's not your
library in this case, it's jquery-file-upload


Reply to this email directly or view it on GitHubhttps://github.com//issues/74#issuecomment-44008999
.

@Capellaro
Copy link
Author

Still your Form demo at http://jpillora.com/xdomain/example/formdata/ is not working on IE8/9 when trying to upload anything.

@jpillora
Copy link
Owner

They don't have FormData, so it won't work

On Monday, May 26, 2014, AlexCapi [email protected] wrote:

Still your Form demo at http://jpillora.com/xdomain/example/formdata/ is
not working on IE8/9


Reply to this email directly or view it on GitHubhttps://github.com//issues/74#issuecomment-44160636
.

@Capellaro
Copy link
Author

You should specify in the description of your library that upload does not work in IE8 / 9 using XDomain in this case.

@mabotofu
Copy link

It's possible to upload anything if you can convert the file into base64 string format. Sadly IE8 and 9 don't support File API so it can't load local files but you can use Flash. I've used this http://aymkdn.github.io/FileToDataURI/ and xdomain to successfully upload files without any issues on those browsers. It's far better than iframe hack.

@jpillora
Copy link
Owner

+1

On Wed, Jun 11, 2014 at 1:14 AM, Naomi Suzuki [email protected]
wrote:

It's possible to upload anything if you can convert the file into base64
string format. Sadly IE8 and 9 don't support File API so it can't load
local files but you can use Flash. I've used this
http://aymkdn.github.io/FileToDataURI/ and xdomain to successfully upload
files without any issues on those browsers. It's far better than iframe
hack.


Reply to this email directly or view it on GitHub
#74 (comment).

@jpillora
Copy link
Owner

XDomain supports FormData though IE8&9 do not. A flash uploader would use the flash's AJAX implementation instead of XMLHttpRequest, so XDomain will never work in conjunction with flash.

As @mabotofu points out, you can flash to convert a file to a base64 string, then send that via JS ajax (which XDomain can work with). Will close this for now and suggest @mabotofu's solution as the IE89 file upload workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants