Click here to Skip to main content
12,394,573 members (75,066 online)
Rate this:
Please Sign up or sign in to vote.
See more: image
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.
cmd.Parameters.Add(@Image_Path) = fileupload1.Filename

[Edit]Code block added[/Edit]
Posted 17-Feb-13 6:40am
Updated 17-Feb-13 6:45am
Sergey Alexandrovich Kryukov 17-Feb-13 12:59pm
Why? Is it the path on client or server-side file system?
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is what you can get:
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[^]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100