如何上传文件到IIS虚拟目录?
我正在编写一个需要上传文件的.NET 应用程序。我有表示层、服务层和数据层。文件在表示层(MVC)中提交,然后由数据层保存。目前我将文件保存到文件系统 - C:\SomeDirectory,但我需要将它们保存在由 Plesk 管理的 IIS 中的虚拟目录中。有人遇到过解释如何将文件保存到 IIS 中的虚拟目录的资源吗?
我应该将文件上传到虚拟目录吗?
谢谢你!
I'm writing a .NET application that needs to upload files. I have presentation, service and data layers. Files get submitted in the Presentation layer (MVC), and then saved by the Data layer. Currently I'm saving files to the file system - C:\SomeDirectory, but I need to save them within the virtual directory in IIS which is managed by Plesk. Did anybody come across any resources explaining how to save files to the virtual directory in IIS?
Should I be uploading files to virtual directory at all?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
保存到虚拟目录本身并没有什么问题,但它并不是真正的目的。最好的保存方法是尽可能获取虚拟目录的绝对路径(如果在站点根目录之外)。
There isn't anything wrong with saving to a virtual directory as such, but it isn't really meant for that. The best way of saving is to try to get the absolute path of the virtual directory (if outside your site root) if at all possible.