Re: Inserting images into a blob thro' a PHP Script............
| From: | Erin's Fan Club© | Date: | Tue, 08 Aug 2000 21:43:21 +0000 |
| Subject: | Re: Inserting images into a blob thro' a PHP Script............ | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-1643@lists.php.net to get a copy of this message | ||
Hi Vinod, group:
>We were trying to upload and insert images into a mysql
> db thro' a PHP Script.We are facing the following problems:
> 1)The file is not getting uploaded or moved to the temp dir.
To ask the obvious, have you uncommented and modified this
line in PHP.INI from;
; upload_tmp_dir = /tmp/
to
upload_tmp_dir = C:/temp/
or whatever temp dir you use?
> 2)When we place the image in the temp dir. manually and
> insert it, the image gets stored in the db.But while retrirving
> it we just get raw data.When we inspect the MySql db we
> just find similar records as below:
> id filename filesize filetype bin_data
> -- -------- -------- -------- --------
> 25 39.jpg 78086 image/pjpeg ÿØÿà
To quote from the Kingfisher book (O'Rielly's MySQL book) re
datatypes...
Type Size Comments
---------------------------------------------------
TEXT/LONG VARCHAR length+2 64kb
TEXT/LONG VARBINARY length+2 64kb
MEDIUMTEXT length+3 16Mb
MEDIUMBLOB length+3 16Mb
LONGTEXT length+4 4Gb
LONGBLOB length+4 4Gb
*) BLOB's being binary, TEXT === non-binary!
It seems as if CHAR or BINARY are of fixed length and if
data is inserted < length, the string is padded with
spaces.
CHAR VARYING, VARCHAR or VARBINARY are also
of a set length of between 1 - 255 chars.
Also noted; "By default, MySQL ignores case when
sorting text and the BINARY attribute should be used to
override this behaviour.
> We are at loss to find out where we are wrong though
> we have spent hell a lot of time.Please respond with
> guidelines to get this thing working.
Hope this helps. I am just learning PHP/MySQL, so this
is not tried and tested. Good luck :-)
> GIVEN BELOW IS OUR CODE:
>
> <<SnIpPeD cOdE>>
>
Regards to one and all, EF