F
fa_2064
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\\iranian\\images\\user_imgs\\Untitled-1.jpg\" is
denied." }
is there a way that the url be relative???
my code is:
public void btnupload_ServerClick(object sender, System.EventArgs e)
{
string uploadFolder =
"D:\\Inetpub\\wwwroot\\iranian\\images\\user_imgs\\" ;
if (!(filename.PostedFile.FileName == "")){
filename.Value.Insert(0,filename.PostedFile.FileName.ToString()) ;
}
System.IO.FileInfo objfile;
objfile= new System.IO.FileInfo(filename.Value);
if (!objfile.Exists){
HttpContext.Current.Response.Write("<script
language=javascript>alert('! ÙØ§ÛŒÙ„ انتخابی وجود
ندارد');</script>");
}else{
string sPath = uploadFolder;
string fname = filename.Value;
int pos;
string extension;
pos = fname.LastIndexOf(".");
extension = (fname.Substring(pos + 1)).ToLower();
if (!( extension == "jpg" ) | (pos == -1)){
HttpContext.Current.Response.Write("<script
language=javascript>alert('!(*.jpg ) نوع ÙØ§ÛŒÙ„ انتخابی
معتبر نمی باشد');</script>");
}else{
int inroot;
inroot =
fname.IndexOf("D:\\Inetpub\\wwwroot\\iranian\\images\\user_imgs\\", 0);
//build file info for display
pos = fname.LastIndexOf("\\");
fname = fname.Substring(pos + 1);
sPath += fname;
try
{
if (filename.PostedFile != null)
{
filename.PostedFile.SaveAs(sPath);
Application.Add("fname", sPath);
}
}
catch(System.Exception exc)
{
HttpContext.Current.Response.Write("<script
language=javascript>alert('! مشکلی در جایگزینی
تصویر وجود دارد');</script>");
}
}
}
}
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\\iranian\\images\\user_imgs\\Untitled-1.jpg\" is
denied." }
is there a way that the url be relative???
my code is:
public void btnupload_ServerClick(object sender, System.EventArgs e)
{
string uploadFolder =
"D:\\Inetpub\\wwwroot\\iranian\\images\\user_imgs\\" ;
if (!(filename.PostedFile.FileName == "")){
filename.Value.Insert(0,filename.PostedFile.FileName.ToString()) ;
}
System.IO.FileInfo objfile;
objfile= new System.IO.FileInfo(filename.Value);
if (!objfile.Exists){
HttpContext.Current.Response.Write("<script
language=javascript>alert('! ÙØ§ÛŒÙ„ انتخابی وجود
ندارد');</script>");
}else{
string sPath = uploadFolder;
string fname = filename.Value;
int pos;
string extension;
pos = fname.LastIndexOf(".");
extension = (fname.Substring(pos + 1)).ToLower();
if (!( extension == "jpg" ) | (pos == -1)){
HttpContext.Current.Response.Write("<script
language=javascript>alert('!(*.jpg ) نوع ÙØ§ÛŒÙ„ انتخابی
معتبر نمی باشد');</script>");
}else{
int inroot;
inroot =
fname.IndexOf("D:\\Inetpub\\wwwroot\\iranian\\images\\user_imgs\\", 0);
//build file info for display
pos = fname.LastIndexOf("\\");
fname = fname.Substring(pos + 1);
sPath += fname;
try
{
if (filename.PostedFile != null)
{
filename.PostedFile.SaveAs(sPath);
Application.Add("fname", sPath);
}
}
catch(System.Exception exc)
{
HttpContext.Current.Response.Write("<script
language=javascript>alert('! مشکلی در جایگزینی
تصویر وجود دارد');</script>");
}
}
}
}