hi every body
when i run this code i receive this error! my "wwwroot" folder is
shared, but i don't know what it's reason is!!!
{"Access to the path
\"D:\\Inetpub\\ wwwroot\\irania n\\images\\user _imgs\\Untitled-1.jpg\" is
denied." }
is there a way that the url be relative???
my code is:
public void btnupload_Serve rClick(object sender, System.EventArg s e)
{
string uploadFolder =
"D:\\Inetpub\\w wwroot\\iranian \\images\\user_ imgs\\" ;
if (!(filename.Pos tedFile.FileNam e == "")){
filename.Value. Insert(0,filena me.PostedFile.F ileName.ToStrin g()) ;
}
System.IO.FileI nfo objfile;
objfile= new System.IO.FileI nfo(filename.Va lue);
if (!objfile.Exist s){
HttpContext.Cur rent.Response.W rite("<script
language=javasc ript>alert('! فایل انتخابی وجود
ندارد');</script>");
}else{
string sPath = uploadFolder;
string fname = filename.Value;
int pos;
string extension;
pos = fname.LastIndex Of(".");
extension = (fname.Substrin g(pos + 1)).ToLower();
if (!( extension == "jpg" ) | (pos == -1)){
HttpContext.Cur rent.Response.W rite("<script
language=javasc ript>alert('!(* .jpg ) نوع فایل انتخابی
معتبر نمی باشد');</script>");
}else{
int inroot;
inroot =
fname.IndexOf(" D:\\Inetpub\\ww wroot\\iranian\ \images\\user_i mgs\\", 0);
//build file info for display
pos = fname.LastIndex Of("\\");
fname = fname.Substring (pos + 1);
sPath += fname;
try
{
if (filename.Poste dFile != null)
{
filename.Posted File.SaveAs(sPa th);
Application.Add ("fname", sPath);
}
}
catch(System.Ex ception exc)
{
HttpContext.Cur rent.Response.W rite("<script
language=javasc ript>alert('! مشکلی در جایگزین
تصویر وجود دارد');</script>");
}
}
}
}