1

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

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

1 Comment

well thanks for your help yes its what i want to send the data with what ever format base64 or binary to the server but I'm going crazy i don't find the compatible way with all browsers and also I'm going crazy i don't know how jquery do it all i do is going around with iframe :( putting all upload stuff there but i wana find it in Javascript thanx again i know its a strange issue and solutions is all around with jquery but i wish find it as i think in javascript pure with older version of HTML :)

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.