MultipleFileUpload.aspx.cs
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MultipleFileUpload.aspx.cs"
Inherits="MultipleFileUploadJquery.MultipleFileUpload" %>
Include the below script
< script src="Scripts/jquery-1.8.2.js" type="text/javascript">
< script src="Scripts/jquery.MultiFile.js" type="text/javascript">
Code
< form id="form1" runat="server">
< div >
< asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" / >
< asp:Label ID="lblMessage" runat="server" / >
< /div >
< /form >
< /body >
< /html >
MultipleFileUploadJquery,aspx.cs
using System;
using System.IO;
using System.Web;
namespace MultipleFileUploadJquery
{
public partial class MultipleFileUpload : System.Web.UI.Page
{
protected void btnUpload_Click(object sender, EventArgs e)
{
HttpFileCollection fileCollection = Request.Files;
for (int i = 0; i < fileCollection.Count; i++)
{
HttpPostedFile uploadfile = fileCollection[i];
string fileName = Path.GetFileName(uploadfile.FileName);
if (uploadfile.ContentLength > 0)
{
uploadfile.SaveAs(Server.MapPath("~/UploadFiles/") + fileName);
lblMessage.Text += fileName +""+ "Saved Successfully";
}
}
}
}
}
Multifile upload Code in C# Visual Studio 2010 are in the following path
http://sdrv.ms/103livW
No comments:
Post a Comment
Comments Welcome