File Attachements from database

S

Sehboo

I have a table with field of type image which has binary data in it.
data could be of image/doc/text/etc type. I need to send this data as
file attachments in emails. I should read the data, store it in some
temp file and then attach that file?

Is there any code?

Thanks
 
F

ForrestPhoto

I have a table with field of type image which has binary data in it.
data could be of image/doc/text/etc type. I need to send this data as
file attachments in emails. I should read the data, store it in some
temp file and then attach that file?

You'll get better performance ( in this scenario and in general ) if
you leave the files in the file system and then just store the paths in
the database. But this info might not help very much after you've
already got things set up...
 
D

Dave Sexton

Hi,

Although that approach doesn't scale well at all. The server and the
database cannot change unless the paths of the new servers remain identical,
load balancing may be difficult and there's more room for error since the
data is just being referenced, not stored. Also, security may be an issue.

Truthfully, I don't know that better performance is attainable simply by
storing the attachments on the file system. Storing them in the database
and using the "string" overload for the Attachment constructor may prove to
be faster since there may be less I/O happening, especially if the code
needs to access the database for other data anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top