1
Answer

fileupload control in visual studio 2010

Ask a question
Trisha

Trisha

11y
2.3k
1
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)