Click here to Skip to main content
15,887,812 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everybody.
I had a question about FileUpload in asp.net.
The C# code is like this:
C#
imgUp.SaveAs(Server.MapPath("..")+@"/img/products/"+imgName);


And when executing, this exception occurs:
The given path's format is not supported

So whats the problem with that?
What should i do to rectify this error?

Thanks.
Posted
Updated 11-May-14 1:02am
v2

Try imgUp.SaveAs(Server.MapPath("..")+@"\img\products\"+imgName);
 
Share this answer
 
Comments
rogerfederer670 11-May-14 7:08am    
I tried that but the exception still occurs.
Abhinav S 11-May-14 7:27am    
Try Server.MapPath("~\img\products\"+imgName");
rogerfederer670 11-May-14 7:51am    
If this statement be used,the imgName variable won't work right.
Because it goes in the "".
It was because of the illegal characters(for file name) in the imgName variable that were used.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900