-
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
Setting custom headers for $upload.upload() or sending file with $upload.http() in IE8-9 #129
Comments
This is just a warning so you can ignore it:
|
I see. And I think it is ok. |
Hey, I now see that FileReader is not defined in IE9. And I need to support that.. What is your suggestion? |
Use a FileReader polyfill library for those browsers like this: |
Thanks. Added it, and now I have a file reader. $scope.onFileSelect = function ($files) { I get an empty array when I chose a single file.. |
include angular-file-upload-shim.js |
Did that (the min version).. and put it before angular.js |
Then I need to see your code and any errors you get in the logs. |
Ok. LiveReload disabled because the browser does not seem to support web sockets Regarding code: Here is the order of loading scripts: src="libraries/jquery/jquery.js" And here is the part for loading the file-reader src="libraries/swfobject/swfobject/swfobject.js" As for the view, I'm just using an input with type=file and binding using the ng-file-select directive. var certFile = null; The function is called, but the $files is an empty array. In the file-reader documentation, I should initialized the file-reader using: Thanks |
include src="libraries/ng-file-upload/angular-file-upload-shim.min.js" not |
Nice, now I see that the controller gets the selected file. |
No it's not a bug, that's a flash button, show the file name using angular |
Thanks. I still can't get it worked. When doing: I get the following error: Did you encounter such issue? I cannot find any information on this. |
The Demo is the first link on the README home page of this module. If you are using FileReader polyfill to read the file you gotta use their own way of reading the files in order to work. See the https://github.com/Jahdrien/FileReader Usage. However FileAPI new version gonna have FileReader polyfill and hopefully it will be released this month. That's why I haven't integrated any other file reader polyfill in here and waiting for that to complete. |
I see. How can I be notified when this is done? |
I will close this issue once the FileAPI's |
Great thanks! From: danialfarid [mailto:notifications@github.com] I will close this issue once the FileAPI's FileReader is ready to be Reply to this email directly or view it on |
Actually it is not that easy to support uploading the file content directly in a post for IE8-9 with flash. I also posted on stackoverflow but got no response so far. So for now there will be no support for $upload.http() for non-HTML5 browsers unless I find another workaround. Although after the new release of FileAPI I can add |
related issue #79 |
So there is no way to send custom headers with flash? Seems fairly ridiculous? |
@benbracha |
I wanted to send file's content to the server, and it expects a
'Content-Type': 'application/octet-stream'
But even when setting it in the $upload.upload() (setting the 'headers'), it gets overridden.
Daniel answer for this:
$upload.upload() need to have the content type formdata-multipart for the server to be able to decode the content of the request so you cannot change that.
For that purpose, we should use the $upload.http() call, as here:
See this: #88 (comment)
The text was updated successfully, but these errors were encountered: