save file to virtual directory

raklos picture raklos · Mar 20, 2011 · Viewed 18.6k times · Source

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).

How can I save files to this folder and then access using eg /images/foo.jpg?

httpdocs/
--web.config
--default.aspx
--etc

assets/
--images/
----foo.jpg

Answer

SLaks picture SLaks · Mar 20, 2011

You can save files normally (using FileStreams or other things).
Call Server.MapPath("~/httpdocs") to get the path on disk.