Cannot use a leading .. to exit above the top directory.
-
I get the exception : Cannot use a leading .. to exit above the top directory. when I try to save a picture to the server, I use the line:
fupPicSummary.PostedFile.SaveAs(Server.MapPath(@"../Pictures/summary_" + campaign.ID + ".jpg"));
-
I get the exception : Cannot use a leading .. to exit above the top directory. when I try to save a picture to the server, I use the line:
fupPicSummary.PostedFile.SaveAs(Server.MapPath(@"../Pictures/summary_" + campaign.ID + ".jpg"));
If the Pictures folder is under the root folder of your web application than this exception will be thrown. The ../ is attempting to go above the root folder, which is not allowed.
I know the language. I've read a book. - _Madmatt
-
If the Pictures folder is under the root folder of your web application than this exception will be thrown. The ../ is attempting to go above the root folder, which is not allowed.
I know the language. I've read a book. - _Madmatt
-
the pictures folder under a sub-domain. can I access it somehow else than full physical type?
You have to use the tilde character "~" to specify a path who start from the root of your web app. the code will be :
fupPicSummary.PostedFile.SaveAs(Server.MapPath(@"~/Pictures/summary_" + campaign.ID + ".jpg"));