Multiple File upload with link in the Email

Posted by Ypanchal under ASP.NET on 4/20/2012 | Points: 10 | Views : 1243 | Status : [Member] | Replies : 1
I am looking for the complete code for the multiple file upload to the server and the link for the saved file which I can send it in the email in the same form.

Thanks,




Responses

Posted by: Johnbhatt on: 7/7/2012 [Member] Starter | Points: 25

Up
0
Down
Multiple File Uploading.

 protected void Button1_Click(object sender, EventArgs e)

{
string filePath = Server.MapPath("Uploads");
if (!Directory.Exists(filePath))
Directory.CreateDirectory(filePath);
HttpPostedFile fileObj;
Label1.Text = "Uploaded Files ";
int tc = Request.Files.Count;
string fname = "";
for (int i = 0; i < tc; i++)
{
fileObj = Request.Files[i];
if (fileObj.FileName != "")
{
fname = fileObj.FileName;
fileObj.SaveAs(filePath + "\\" + fname);
Label1.Text += "<li>" + fname;
}
}
}

Uploaded File Names are printed in Label1 in above example.

John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

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

Login to post response