保存文件到虚拟目录 [英] save file to virtual directory
问题描述
我知道如何做到这一点,我使用的共享主机。我在 http://www.example.com/images 一个虚拟目录。这个目录实际上是在服务器资产的文件夹/图像,而我的网站是在/ httpdocs资料(httpdocs和资产文件夹是在同一级别)。
Hi I am unsure how to do this, I am using shared hosting. I have a virtual directory at http://www.example.com/images. This directory is actually a folder on the server assets/images whereas my site is at /httpdocs (httpdocs and assets folder are at the same level).
我怎样才能将文件保存到这个文件夹,然后访问使用如/images/foo.jpg?
How can I save files to this folder and then access using eg /images/foo.jpg?
httpdocs资料/
--web.config
--default.aspx
--etc
httpdocs/
--web.config
--default.aspx
--etc
资产/
--images /
---- foo.jpg
assets/
--images/
----foo.jpg
推荐答案
您可以将文件保存正常(使用的FileStream
s或其他东西)。
呼叫使用Server.Mappath(〜/ httpdocs资料)
来获得磁盘的路径。
You can save files normally (using FileStream
s or other things).
Call Server.MapPath("~/httpdocs")
to get the path on disk.
这篇关于保存文件到虚拟目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!