Forum Moderators: coopster
I am successfully storing images to MySQL, and succesfully retrieving them for display on a page in the following format:
<img width="106" height="160" border="0" src="imageserver.php?image_id=44">
where imageserver.php echos the appropriate header and data for the image:
...
$result = $db->queryRaw($sql) ;
header("Content-type: $type");
echo mysql_result($result, 0);
...
Problem:
I would like to attach these images to an email. I have successfully attached standard files (in the form 'image_44.jpg'), but when I use 'imageserver.php?image_id=44', I get the following types of errors:
Warning: filetype() [function.filetype]: Lstat failed for [example...]
Warning: filesize() [function.filesize]: stat failed for [example...]
Warning: fread() [function.fread]: Length parameter must be greater than 0 in...
An example of the code that fails is:
$fileatttype = filetype($fileatt);
which works fine when it's a regular file... is there an extra step I'm missing to make data pulled from a database readable as a regular file?