asp.net - Save file in a folder above the site files -


my host has following structure:

/web -> content of site /data -> folder permissions read , write

how upload file data folder? code below not work, since "~" returns directory / web.

//save image var serverpath = server.mappath(href("~/data/") + id); directory.createdirectory(serverpath); imgori.save(path.combine(serverpath, filename)); 

server.mappath() designed map path root directory of application. trying upload file above root won't work.

you can upload file above root specifying exact file path (if host can provide it):

var serverpath = "c:\yourfolder\data\") + id);

i'm surprised host allowing upload file outside of root directory there number of dangers in doing this...you may run trust issues.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -