Problem while saving files with multiple file upload [Resolved]

Posted by Amritha444 under ASP.NET on 6/21/2014 | Points: 10 | Views : 1725 | Status : [Member] | Replies : 2
Hi all
Iam using multiple file upload control to upload multiple files and sending this through mail ... i got code fro here

http://www.aspsnippets.com/Articles/Upload-and-attach-multiple-files-as-attachments-to-email-in-ASPNet.aspx

sending files through mail using this code
   List<HttpPostedFile> files = (List<HttpPostedFile>)Cache[this.Key];
foreach (HttpPostedFile file in files)
{
mail.Attachments.Add(new Attachment(file.InputStream, Path.GetFileName(file.FileName), file.ContentType));
}

its working well .
.i want to save all attachments to my project folder
   List<HttpPostedFile> files = (List<HttpPostedFile>)Cache[this.Key]; string lscoll = "";
foreach (HttpPostedFile file in files)
{

fuattachfile.PostedFile.SaveAs(SerPth + Path.GetFileName(file.FileName));
}

im getting files without content in the project folder ...but its going well with images .. how to resolve this??




Responses

Posted by: Amritha444 on: 6/21/2014 [Member] Starter | Points: 25

Up
0
Down

Resolved
solved my problem using this

file.SaveAs(SerPth + Path.GetFileName(file.FileName));


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

Posted by: Goud.Kv on: 6/21/2014 [Member] [MVP] Gold | Points: 25

Up
0
Down
Hello Amrutha,
Please made your post clear as it is not easily readable. Use CODE and LINK options to do that.

Thanks & Regards,
Krishna

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

Login to post response