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
Post a Comment