-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
issues with xdomain.js? #113
Comments
For HTML5 browsers shim replaces XMLHttpRequest just to override the |
thanks for the quick reply. loading stuff in this order throw: Cannot call method 'addEventListener' of undefined |
What browser? |
chrome |
By the way this won't work for IE8-9 FileAPI, since it is using flash to send the request not XMLHttpRequest so the cross domain policy will not allow you to upload unless you setup crossdomain.xml file on your server. |
The error means that xdomain.js modify XMLHttpRequest and removes xhr.upload which means that you won't be able to listen to progress event unless it provides another way of doing it. |
maybe I can avoid progress but even without the shim the file is not uploaded. I guess xdomain is somehow removing it but I'm not that expert of XMLHttpRequest to understand. I'm trying to console.log stuff from xdomain looking for where it rebuild the request removing the file. Do you know where is the file in the XMLHttpRequest object? |
Could you copy paste here the actual request being sent to the server from Chrome including headers and contents? |
The file is added to the xhr using xhr.send(formData) function. The formData is the actual file content and XMLHttpRequest would normally put the content of the formData as multipart/form-data in the request content. It is possible that xdomain has not implemented that yet and just accepts json data in xhr.send(). The other approach would be to use $upload.http() method which send the actual binary of the file as |
Request URL:https://api.local.com/uploads/image |
and your js code that calls upload |
|
Try to include shim after xdomain again and comment out lines 21 to 42 of angular-file-upload.js. See if anything changes. |
there is no addEventListener error but still no file received from the server |
Then xdomain changes the way send() and addRequestHeader functions work. I think you better open an issue on their github. |
Thanks for trying out this issue. As this seems not resolved I had to move on https://github.com/nervgh/angular-file-upload. |
Hi guys, I'm using xdomain.js to do cors stuff.
Your script works without xdomain but using also xdomain result in a server error saying the file was not found.
(I tried loading angular-file-upload-shim.js before xdomain and after it, the issue is the same).
Both libraries hacks the XHR object. I think:
xdomain is using xhook and uploads seems to be supported there.
( I tried also to not load the shim but it doesn't work as well)
I need some hint to debug the issue.
Thanks for this module and for you help!
The text was updated successfully, but these errors were encountered: