Please enable Javascript to correctly display the contents on Dot Net Tricks!

Asp.Net asynchronous file upload using jquery

  Author : Shailendra Chauhan
Updated On : 24 Sep 2016
Total Views : 24,182   

In ajax, we have AsyncFileUpload control for uploading files asynchronously. If you are using JQuery with in your application, then using microsoft ajax AsyncFileUpload control is not a good practice to upload files asynchronously. Form Last couples of days I was trying to upload and delete files asynchronously using JQuery in Asp.Net and finally I was able to upload and delete files asynchronously. Here I am sharing my asynchronous file upload code. For getting file size before upload refer the article Get file size before upload using jquery.

In order to get the things going well, you’ll need the following :-

  1. JQuery 1.4 or above. You can download it form here

  2. JQuery File Upload plugin You can download it form here

Simple File Upload Control

When you will run this code, you will find the below screen for uploading the files. This is a simple file upload control with browse button.

Change style of browse button

To achieve this, I am uisng css to change the default style of file upload control. Basically I put the file upload control in a wrapper and this wrapper will be shown to the user in-place of file upload control as shown below:

Now you can upload file to the server on single click after browsing the file. For uploded file you can also provide the description. By default it is showing the file name. You can change this description as you wish.

Every time when you will come on this page a new folder will be created and yours uploaded files will be saved in this newly created folder.

Check file extension to be upload

In this demo, I am also checking the file extension to be upload. You can define your own extension of file to be upload. If you try to upload the file that is not present in extensions list it will show the below error message.

View/Download file from Server

You can view or download the uploaded file from the server. When you will click the view link then you will see the below option in IE for save and open file from the server.

Delete file from Server

When you will click on the delete link , it will ask for confirmation. If you click ok, then it will delete the file. Screen shots for the file deleting process are shown as -


In this article I try to explain the file upload in using jquery with example. I hope you will refer this article and code to solve your problem of file upload. I would like to have feedback from my blog readers. Please post your feedback, question, or comments about this article. You can download demo project from below link.

Free Interview Books
13 NOV
MEAN Stack Development (offline)

Sat, Sun (11:00 AM-12:30 PM IST)

Know More
PPC Marketing (offline)

Sat, Sun 09:00 AM-10:30 AM IST

Know More
ASP.NET MVC with AngularJS Development (offline)

SAT,SUN 08:00 AM-09:30 AM

Know More
Spoken English & Personality Development (offline)

Sat,Sun 05:00 PM-06:30 PM IST

Know More
NodeJS Development (online)

MON-FRI 06:00 AM - 07:30 AM IST

Know More
AngularJS Development (online)

MON-FRI 08:00 PM-09:30 PM IST.

Know More
27 OCT
ASP.NET MVC with AngularJS Development (online)

MON-FRI     07:30 AM-09:00 AM IST

25 OCT
.NET Development (offline)

Mon-Fri     9:00 AM-11:00 AM IST

24 OCT
MEAN Stack Development (online)

MON-FRI     06:00 AM -07:30 AM IST

12 OCT
ASP.NET MVC with AngularJS Development (online)

Mon-Fri     09:30 PM-11:00 PM IST

17 SEP
ASP.NET MVC with AngularJS Development (online)

Sat, Sun     03:00 PM-05:00 PM IST

17 SEP
ASP.NET MVC with AngularJS Development (offline)

SAT,SUN     05:00 PM-06:30 PM IST

NodeJS Development (offline)

Sat, Sun     11:00 AM-12:30 PM IST

24 JUL
PPC Marketing (offline)

Sat,Sun     03:00 PM-05:00 PM


Professional Speaks