Link to home
Start Free TrialLog in
Avatar of bewildered
bewildered

asked on

Stored procedure to convert blob to image file

Windows 2003 Server running IIS and SQL Express 2005

I have clients who send records containing some images to my SQL server. (Each record can contain upto 10 image fields)  Although using  blobs to contain images on their client software is a good idea, I would prefer to use the local file system for the purpose of displaying the images from IIS

I am hoping to create a trigger on the SQL Server so as a record is updated or added, the blob is saved to the local file system as an image file. It then can be access by IIS and displayed to a users browser.

I am not an expert on SQL Server, but I figured a stored procedure could be called by the trigger ...

Is this possible from withing a stored procedure?


Avatar of bamboo7431
bamboo7431

"Although using  blobs to contain images on their client software is a good idea"
Why?
Create a root directory called, say, D:\ClientImages
Under it have a folder for each client. When the client 5 uploads an image mypic.jpg, place it into D:\ClientImages\5\mypic.jpg
If you don't let them create folders, but only to place the images in one directory, your table will look like:
(clientID, fileName) with the values(5,'mypic.jpg')
That was the file is always on the file system, you lower the storage costs on the DB tremendously and everyone is happy
Avatar of bewildered

ASKER

Hi,

A Data entry person adds records to an access db that include images. The access DB is then copied to one or more laptops for sales staff to go on the road with.

This is a simple and clean method to make the data available to staff who do not have an internet connection available while travelling.

The Data entry person also uploads the records from the central access DB to the SQL server. At this point I would like to create the individual image files for use on the website.

Cheers Tony
ASKER CERTIFIED SOLUTION
Avatar of bamboo7431
bamboo7431

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
Thanks for the input,

I think I will abandon the question ...