Trisha

Trisha

  • NA
  • 4
  • 6.1k

fileupload control in visual studio 2010

Aug 23 2013 10:12 PM
Hi everyone i am stuck in my code.
i am trying to upload a image on my asp.net web page using visual studio 2010.
 
for just try i used this code
 
protected void Button1_Click(object sender, EventArgs e)
{
FileUpload1.SaveAs(Server.MapPath("~/image/""));
}
i have image folder on my project like webapplication - image.
 
but when i try to run the code everytime it gives the same error, could not found the part of path.
 
FileUpload1.SaveAs(Server.MapPath("~/"));
FileUpload1.SaveAs(Server.MapPath("~"));
 
i tried all these because i found by checking on internet these different ways, but no one work for me. i check the folder image has a write permission too.
so please can anyone give me solution.
thanks in advance.

Answers (1)