i want to save file upload file in 'C:\\inetpub\\wwwroot\\Content\\SpeechFile\\' in visual studio i can save this files
if (file != null)
{
string urlfile;
string path = Server.MapPath("~" + "\\Content\\Apk\\");
string filename = System.IO.Path.GetFileName(file.FileName);
while (System.IO.File.Exists(path + "\\" + filename))
filename = "1" + filename;
urlfile = "../../Content/Apk/" + filename;
file.SaveAs(path + filename);
model.Fileurl = urlfile;
}
but on server i have an error
Access to the path 'C:\\inetpub\\wwwroot\\Content\\SpeechFile\\nokia 700.jpg' is denied.
Generally the user account the application pool runs under will not have permissions to write to any sub-folders for security reasons. You will have to check which user your application runs under and then give that user write permissions to the SpeechFile
folder. Make sure that is the only folder that you do give it write permissions to so that the security risk is minimised.
The only way to solve this problem is to not write to that folder. You are not allowed to write to that folder .Just Tried to Give Access Rights
to your Folder SpeechFile
.
You may also use Environment.SpecialFolder to help you find where you need to go.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.