How do you get the file stream in javascript and POST using AJAX?

I receive a file using FORM POST

in ASP.NET and send it like this:

StreamReader sr = new StreamReader(fStream);
Response.Write(sr.ReadToEnd());

      

What I want to do at this point is take the data and then re-execute it with AJAX. The problem is I am trying to figure out how the data should be encoded or appended to the jQuery AJAX data attribute POST

.

Is it possible? Can I get a server side file stream, send it back as a stream (or whatever), store it in a JS variable, and then send it as "data" in jQuery AJAX POST

?

+3


source to share


1 answer


Yes, it is possible to upload the file using jQuery AJAX.

Uploadify

This link may be helpful for you. This is exactly the same example you want. See the code and let me know if you have any questions. I have successfully implemented it in my code.



Benefits:

  • It is also useful for you if your file size is too large.
  • It's easy to implement.
  • AJAX.
0


source







All Articles