我可以在应用程序路径之外保存附件吗? [英] can i Save attachments in outside of application path?
问题描述
我想保存附件自定义路径。
示例:文件夹: - > TestProject
--App_code
--Bn
--uploadfile .aspx
我需要在此路径的外侧保存附件文件
示例:D:/附件/
请任何人帮助我。谢谢你..
我想这应该对你有所帮助
fileupload1.saveas(D:/Attachment/file1.text)
请不要使用server.mappath
beacause server.mappath表示你在项目中的当前位置
以及你用于保存文件的控件如fileuploader
试试FileUpload1.SaveAs( c:\\SaveDirectory \\ + FileUpload1.FileName);
这里有完整的例子 - ASP.NET - 文件上传 [ ^ ]
但如果你没有为Write申请权限,你就会收到错误。为此,请查看以下页面。
如何允许我的Web应用程序写入文件,文件夹和数据库? [ ^ ]
I want to save attachment customized path.
Example: folder: -->TestProject
--App_code
--Bin
--uploadfile.aspx
I need to save attachment file in out side of this path
example: D:/Attachment/
please any one help me. Thank u ..
i think this should be help you
fileupload1.saveas("D:/Attachment/file1.text")
please don't use server.mappath
beacause server.mappath indicate your current position in project
and what control you use for save file like fileuploader
TryFileUpload1.SaveAs("c:\\SaveDirectory\\" + FileUpload1.FileName);
Here complete example - ASP.NET - File Uploading[^]
But you'll get error if you didn't apply permissions for Write. To do that, check the below page.
How Do I Allow My Web Application to Write to Files, Folders and Databases?[^]
这篇关于我可以在应用程序路径之外保存附件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!