I find a very nice Jquery plug in called Uploadify for this. You can download it from here.
They have starting example on the site a PHP code snippet. I just want to share my Asp.net Implementation.
First of all download Jquery and Uploadify plug in the create a Asp.net website using Visual Studio or Visual Web Developer and copy the "uploadify" folder to your web site. Now Add reference of following files to your aspx page. like this
Now include the reference to uploadify.css file. otherwise it will not display as you expect.
Now add this script to you aspx page
Finally Add a Generic handler (see the Handler.ashx in front of 'script' property of uploadify)
<%@ WebHandler Language="C#" Class="Handler" %>Happy coding :)
using System;
using System.Web;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
string path = string.Empty;
for (int j = 0; j < uploadfile =" context.Request.Files[j];" path =" context.Server.MapPath("> 0)
{
uploadFile.SaveAs(path);
}
}
}
public bool IsReusable {
get {
return false;
}
}
}
you can read detail of uploadify function and its properties from here
Now run the page and it will look like image below.
Thank you Bhatti saab, very informative indeed . I am trying to make asp.net insert form with this upload, once i am done i will share..thanks again and keep writing.
ReplyDelete@Abdul Rehman
ReplyDeleteThanks for nice words. I am glad you found the post helpful. I always try to share solution of problems i face during development.
Hi what is this line of code
ReplyDeleteuploadFile.SaveAs(path);
which is not refrenced anywhere.
Can u post the whole code.
Thanks
please view http://waqarsherbhatti.posterous.com/ for latest posts... And about the line of code you are asking... uploadFile is Asp.net FileUpload Control... which is in Aspx. file...
ReplyDeleteadding progress bar on a web page
ReplyDelete