Click here to Skip to main content
15,885,180 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to store only file name for example rose.jpg but in my code it save as D:\image\rose.jpg
How can i save only file name in db??
Posted
Comments
RaisKazi 28-Sep-12 14:55pm    
And from where that full path of image is comming?
Yasir Farooq 28-Sep-12 15:00pm    
upload a image from filedialog. store image and image name in database.
Sergey Alexandrovich Kryukov 28-Sep-12 15:14pm    
Only? What's the problem? Isn't file name is just a string? :-)
--SA
Yasir Farooq 28-Sep-12 15:19pm    
I apply a query after opening filedialog it automatic save image and image address in database
just like in image column 'binary data' and in Name column C:\documents\images\*.jpg
i want to save image name like *.jpg in Name column.
Sergey Alexandrovich Kryukov 28-Sep-12 16:10pm    
OK, save it if you want, why not?
--SA

Use the FileInfo[^] class and save the Name[^] property to the database.
 
Share this answer
 
Comments
Maciej Los 28-Sep-12 16:10pm    
Short and to the point, my 5!
First of all, Marcus Kramer answer is very good!
Secondly: If you want to achieve that by MS SQL Server site, have a look here: Get filename from filepath[^]
 
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