使用多个文件上传保存文件时出现问题 [英] Problem while saving files with multiple file upload
问题描述
大家好
Iam使用多个文件上传控件上传多个文件并通过邮件发送...我这里有代码
http://www.aspsnippets.com/Articles/Upload-and-attach-multiple-files-as-attachments-to-email-in-ASPNet.aspx
使用此代码通过邮件发送文件
列表< httppostedfile> files =(List< httppostedfile>)Cache [this.Key];
foreach(文件中的HttpPostedFile文件)
{
mail.Attachments .Add(new Attachment(file.InputStream,Path.GetFileName(file.FileName),file.ContentType));
}
运行良好。
。我希望将所有附件保存到我的项目文件夹
List< httppostedfile> files =(List< httppostedfile>)Cache [this.Key]; string lscoll =;
foreach(文件中的HttpPostedFile文件)
{
fuattachfile.PostedFile。 SaveAs(SerPth + Path.GetFileName(file.FileName));
}
我在项目文件夹中获取没有内容的文件......但它与图像相得益彰。如何解决这个问题??
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??
推荐答案
file.SaveAs(SerPth + Path.GetFileName(file.FileName));
这样写。
write like this.
在那里问。
你得到的代码来自一个不同的网站 - 所以请求编写它的人的支持,因为他们会最好地了解代码。
Ask there.
You got the code from a different site - so ask for support from the person who wrote it, as they will know the code best.
这篇关于使用多个文件上传保存文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!