Reputation: 2402
Dears I'm a ASP.NET Developer , i search for a way that i can upload files using Javascript pure with asp.net web forms and i found it so poor ,i don't need it in jquery / i have searched for things for my purpose and i found methods that can help but i don't know how to fit it to my purpose knowing that i don't need any post backs [Methods like ] sendAsBinary its in XMLHTTPREQUEST OBJECT Supported by firefox and getAsBinaryData and its a method in the file DOM Element Object also supported only by firefox , i wish that some one can help me find a way to do the upload with pure javascript
Thanx
Upvotes: 1
Views: 5549
Reputation: 21269
Something like what you're trying to do is only possible with the HTML5 file api(which allows reading files). I've never had to do something like this before, but I suggest:
//file is ready for sending
var file = fileInput.files[0];
var fReader = new FileReader();
fReader.onloadend = function(){
var xhr = new XMLHttpRequest();
//processing and send
this.result;
};
fReader.readAsDataURL(file);
Upvotes: 2