How to select multiple file using file upload control?

Posted by Prabu_Spark under ASP.NET on 11/26/2012 | Points: 10 | Views : 18089 | Status : [Member] | Replies : 5
Hi sir,
Tell me the steps to select multiple files using file upload control in asp.net. Give me the c# code too.
Kindly give me the solution for this problem.

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: Krv on: 11/26/2012 [Member] Starter | Points: 25

Up
0
Down
Please check out the below url
http://forums.asp.net/t/1717249.aspx/1


-------
Mark it as answer if it helps

Thanks,
R.Vasanth
MCTS(SQL Server & BI)
http://bigdatatech.blogspot.com

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naidulaxmi on: 11/27/2012 [Member] Starter | Points: 25

Up
0
Down
hi,

this is multiple files using file upload control :
for (int i = 0; i <= hfc.Count - 1; i++)
{
HttpPostedFile hpf = hfc[i];
if (hpf.ContentLength > 0 && hpf.ContentLength <= 2097152)
{
hpf.SaveAs(Server.MapPath(@"subdomains\\" + Session["webaddress"].ToString() + "\\images") + "\\" + System.IO.Path.GetFileName(hpf.FileName));
//hpf.SaveAs(Server.MapPath("upload") + "\\" + System.IO.Path.GetFileName(hpf.FileName));
list.InnerHtml += "<b>File: </b>" + hpf.FileName + " <b>Size:</b> " + hpf.ContentLength + " <b>Type:</b> " + hpf.ContentType + " Uploaded Successfully <br/>";
gallery += "<a href='upload/" + hpf.FileName + "' title='' class='thickbox' rel='gallery-plants'><img src='upload/" + hpf.FileName + "' alt='Plant 1' width='100px' height='100px'></a>&nbsp;";
}
else
{
Response.Write("<script>alert('Size is limited to 2MB')</script>");

}
}
thanks,

appalanaidu

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hemanth.Sutapalli on: 11/27/2012 [Member] Starter | Points: 25

Up
0
Down
Hi prabu_spark,
Refer this link, This may Also help you.
http://www.dotnetfunda.com/articles/article981-multiple-files-upload-in-aspnet-and-aspnet-with-jquery.aspx

Thanks & Regards,
S.Hemanth

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Somu475 on: 11/27/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
Refer this, it may help you....

http://ajaxuploader.com/

-Somu

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandhyab on: 11/27/2012 [Member] Starter | Points: 25

Up
0
Down
<asp:FileUpload ID="FileUpload1" runat="server" /><br />

<asp:FileUpload ID="FileUpload2" runat="server" /><br />
<asp:FileUpload ID="FileUpload3" runat="server" /><br />
<asp:FileUpload ID="FileUpload4" runat="server" /><br />
<asp:Button ID="btnUpload" runat="server" Text="Upload Multiple Files" OnClick="UploadMultipleFiles" />

Code Behind:
protected void UploadMultipleFiles(object sender, EventArgs e)

{
HttpFileCollection files = Request.Files;
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile file = files[i];
string path = Server.MapPath("~/");
string fileName = file.FileName;
file.SaveAs(path + fileName);
Response.Write(fileName + " uploaded successfully ! <br />");
}
}


Thanks & Regards

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response