specify the path to save the files

Posted by Shreesh under ASP.NET on 10/21/2011 | Points: 10 | Views : 870 | Status : [Member] | Replies : 2
hello
i need to specify the path to save the files after they are uploaded using "FileUpload " Control, this is the code i have written

if (FileUpload1.PostedFile.FileName != null && FileUpload1.PostedFile.ContentLength > 0)
{


string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
string _fpath = Server.MapPath("") + FileUpload1.FileName;
FileUpload1.SaveAs(_fpath);
Label2.Visible = true;
Label3.Visible = false;

}
}


where should i specify the path e.g-"c:\videos" ?




Responses

Posted by: Jasc on: 10/21/2011 [Member] Starter | Points: 25

Up
0
Down
Hello Shreesh, If you have your own server, means for hosting then you can specify c:/video, neither you only need to map your path at your web site locations. You can also Write Query FileUpload1.Saveas( Request.PhysicalApplicationPath+Fileupload.FileName);
or better explain your requirement so that I can help better.

Shreesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shreesh on: 10/21/2011 [Member] Starter | Points: 25

Up
0
Down
thank you so much. i'l try it.

Shreesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response