code error-gor being a not a "valid path"

Posted by Shreesh under ASP.NET on 10/14/2011 | Points: 10 | Views : 2843 | Status : [Member] | Replies : 2
Hello
I have tried this code to find where the files are uploaded/saved



FileUpload1.SaveAs(Server.MapPath("C:\\")); 


but it returned an error as "'C:\' is not a valid virtual path." please help.




Responses

Posted by: Gausi on: 10/14/2011 [Member] Starter | Points: 25

Up
0
Down
FileUpload1.SaveAs(Server.MapPath());


or

FileUpload1.SaveAs(Server.MapPath("."));  


will point to application folder no need to provide "C:\" in ur code.


Regards,

Gaurav Singh
(gausi)

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

Posted by: Blessyjees on: 10/17/2011 [Member] Bronze | Points: 25

Up
0
Down
hi,

If you are using server.Mappath, there is no need to specify the drive. Please remove this and try.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

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

Login to post response