write image file larger than 4096
Posted
by ntan
on Stack Overflow
See other posts from Stack Overflow
or by ntan
Published on 2010-04-29T15:16:46Z
Indexed on
2010/04/30
6:57 UTC
Read the original article
Hit count: 231
Hi,
*************EDIT**********
i am using ODBC and found that can not read more than 4096 for a field
Any suggestions
*************EDIT************
i am reading an image from db
$image=$row["image-contents"];
Now try to write the file to disk
$image_name="test.jpg";
$file = fopen( "images/".$image_name, "w" );
fwrite( $file, $image);
fclose( $file );
The problem is that the file created is only 4096 bytes and the image file is corrupt because $image is larger than 4096.
I now that fwrite use blocks for write but i dont know how do it.
Help plz!
© Stack Overflow or respective owner