Here Mudassar Ahmed Khan has explained ith an example, how to upload File without Form Submit (PostBack) using jQuery AJAX in ASP.Net using C# and VB.Net.The Generic Handler will be used to upload and save files in Folder (Directory) in ASP.Net.The Generic Handler will be called using jQuery AJAX and the file will be uploaded to Folder (Directory) with Progress Bar using HTML5 Form Data and XmlHttpRequest (XHR).
Đang xem: Upload file without form submit (postback) using jquery ajax in asp
The uploaded File is read from the Request.Files collection and is saved to a Folder (Directory) on Server’s Disk.
The HTML Markup consists of a Form with an HTML FileUpload element and a Button. Below the Form there’s an HTML5 Progress element for displaying the progress of the uploading File.
The Upload Button has been assigned a jQuery Click event handler. When the Upload button is clicked, an AJAX call is made to the Generic Handler using jQuery.
A Progress event handler is attached to the XmlHttpRequest (XHR), which displays the progress of the File being uploaded using the HTML5 Progress element.
The above code has been tested in the following browsers only in versions that support HTML5.
* All browser logos displayed above are property of their respective owners.
Thank you for the feedback. The comment is now awaiting moderation. You will be notified via email when the author replies to your comment.
You can add your comment about this article using the form below. Make sure you provide a valid email address else you won”t be notified when the author replies to your commentPlease note that all comments are moderated and will be deleted if they areNot relavant to the articleSpamAdvertising campaigns or links to other sitesAbusive content.Please do not post code, scripts or snippets.
Disclaimer: The code samples and API available at www.obatambeienwasirherbal.com are available absolutely free. You are free to use it for commercial as well as non-commercial use at your own risk, but you cannot use it for posting on blogs or other tutorial websites similar to www.obatambeienwasirherbal.com without giving reference link to the original article. All the code samples and API provided by the authors are solely their creation and neither the author nor the site are responsible if it does not work as intended.