Link to home
Start Free TrialLog in
Avatar of searchsanjaysharma
searchsanjaysharma

asked on

How upload an image for a record.

I have an VB.Net windows application. I am storing the data in the fields for employees.
Now i want to store the images of the employees.
The pics will be stored in folder with file name saved as id as in employees tables,
What data type should i take for storing images.
1, can be varchar where in we can map the path
2, what could be other way.

Please send example.
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

If the files are all in the same directory and have the same name as the user ID, you do not have to store anything, you already have the information you need, because the ID is already in the database.

When you need to retrieve the image in your application, simply go to the directory that holds the images, and get the employee image from the file that has the same name as the ID field.
Avatar of Ark
If photos aren't huge, I would suggest store them directly in the table in the Image (or binary - depends on DB type) type field. With this approach records and images will always be synchronized - when you delete employer his image will be deleted too, while with file data approach you'll have orphan images and/or records
If there is an application that is used to manage the employees, a single line of code is sufficient to delete the photo when an employee is deleted, so storing the images separately is usually not a problem.

Manipulating photos in files is a lot easier than doing so in a database.

Updating the photos with newer ones would also be easier since it could be done without having an application to do so.
a single line of code is sufficient to delete the photo when an employee is deleted
How many lines is sufficient if file was assidently deleted/renamed?
Manipulating photos in files is a lot easier than doing so in a database. Updating the photos with newer ones would also be easier since it could  be done without having an application to do so
Agree - with 100 employes. What about some thousands?
ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of searchsanjaysharma
searchsanjaysharma

ASKER

ok