保存文件到虚拟目录 [英] save file to virtual directory

查看:133
本文介绍了保存文件到虚拟目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何做到这一点,我使用的共享主机。我在 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 FileStreams or other things).
Call Server.MapPath("~/httpdocs") to get the path on disk.

这篇关于保存文件到虚拟目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆