Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
How to save file path using fileupload control in SQL server database using ASP.NET and vb language.
i am using fileupload controls, when i am storing the images in a database the total path is not saved.
VB
cmd.Parameters.Add(@Image_Path) = fileupload1.Filename


[Edit]Code block added[/Edit]
Posted
Updated 17-Feb-13 6:45am
v4
Comments
Sergey Alexandrovich Kryukov 17-Feb-13 12:59pm    
Why? Is it the path on client or server-side file system?
—SA
Hend Riad 17-Feb-13 15:59pm    
what is the datatype of the variable you store the path in it ?
Farzanatayeb 20-Feb-13 1:35am    
Datatype is varchar(50) and column name is ImagePath

1 solution

This is what you can get:
C#
string path = FileUpload1.PostedFile.FileName 

AFAIR, recent browsers do not pass on the full filepath any more because of security reasons.

Have a look at the following discussions on similar topic:
FileUpload loses directory path.[^]
FileUpload.PostedFile.FileName not giving full path in chrome[^]
 
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