Click here to Skip to main content
13,193,056 members (71,920 online)
Rate this:
Please Sign up or sign in to 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 28-Sep-12 8:54am
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? :-)
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?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Use the FileInfo[^] class and save the Name[^] property to the database.
Maciej Los 28-Sep-12 16:10pm
Short and to the point, my 5!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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[^]

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 |
Web04 | 2.8.171017.2 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2017
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