Hi
Using ASP.NET Web Forms, for now I want to upload a single large file with real time progress.
The real requirement once I jump this hurdle is to upload many large files associated with many upload controls in a FormView Insert or Update event. But for now I am eliminating FormView and am just using one upload control.
I have spent many days on this and have worked on various options.
Option 1: Original ASP.NET File Upload Control
The ASP.NET File Upload control renders a HTML input tag with type=”file” etc.
Given the current HTML5 “standard”; have there been any enhancements to provide real time progress updates from the original ASP.NET File Upload Control natively?
Option 2: AJAX Control Toolkit (ACT)
The end user has to explicitly click Upload for each UI control . Whereas from ASP.NET FormView Insert or Update events, I do it in code behind programmatically for many different upload controls. So, not an option as far as I can see. Furthermore, I do not really want a dependency on ACT.
Option 3: HTML5 File Input using XMLHtTTPRequest Asynchronously to an ASHX Handler
This I can get working in terms of upload, real time progress, saving, and client response.
However, the ASHX code is separate from an ASPX code behind. So I don’t know how I would get C# code working between ASPX code behind, and ASHX during a FormView Insert.
Is there a way to control interflow between ASPX code behind and ASHX code before sending response back to a JavaScript client loaded event?
Option 4: HTML5 File Input using XMLHtTTPRequest Asynchronously to an ASPX Page
I can only get this partly working i.e. uploading with real time progress, and file save on server.
In this option, my code resembles sample code provided in this forum post. Except, I am using asynch i.e. I have
xhr.open("POST", uploadServerSideScriptPath,TRUE);
So, where it fails is that ASPX returns the entire ASPX mark-up - which is normal behaviour; but not what the JavaScript client loaded event code is expecting. It expects plain text responseText parameter i.e. just a simple string message e.g. “Saved filename.ext”.
Is it possible to have ASPX code behind run as usual but also return a plain text responseText to a waiting JavaScript listener function?
Thanks for your help…