perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kee Hinckley <>
Subject Re: Display Blob from database
Date Mon, 04 Nov 2002 17:42:52 GMT
At 9:34 AM -0800 11/4/02, Gerardo Schimpf wrote:
>Hello embperl fans!. I have a mysql table with a blob data type column and
>pictures stores in that column. How can I upload a picture and insert it into
>that column and display the picture on a HTML page?

Uploading the picture you can do using test/html/upload.htm as an example.
Read the file in, stuff the bits in the database.
Displaying is a two part process.  The HTML page should have a reference like:
	<img src="/foo.html?imageid=xxx">
and foo.html should consist of nothing except embperl code, like so:
	$http_headers_out{'Content-Type'} = 'image/xxx';
	$http_headers_out{'Content-Length'} = yyy;
	spit out image data from database
	while (...) { print OUT xxx; }

You probably don't need the exit, I just do it to make sure no more 
data ends up on the output stream.

Kee Hinckley - Somewhere.Com, LLC

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message