Reply to Re: Writing Images to MySQL 4.x

Your name:

Reply:


Posted by Petr Vileta on 09/12/06 15:06

jackpod wrote:
> Hi,
> I have been trying to write an image to a database table BLOB field in
> MySQL but when I try to retrieve the image to display it, it shows as
> being empty. Are there any special considerations I need to take into
> account when reading and writing images to a DB? Thanks.
Writing images into database is not good idea expect if the images are very
small. Better is to create some upload directory and save images here. Into
database you write the (generated) filenames only. The procedure is some
like this:

IF file is attached (uploaded)
genetare new unique filename
get file extension from original filename
save attached file into upload directory as
generated_filename.original_extension
put new filename into some table
ENDIF

And procedure for viewing in browser is like this

IF ! EMPTY(filename in table)
echo "<img src=\"upload_directory/$filename\">";
ENDIF

--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация