List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 5 2001 5:40pm
Subject:RE: Problem with BLOB and JPG files
View as plain text  
At 7:34 PM +0200 9/5/01, Carsten H. Pedersen wrote:
>  > -----Original Message-----
>>  From: Paul DuBois [mailto:paul@stripped]
>>
>>  At 6:35 PM +0200 9/5/01, Carsten H. Pedersen wrote:
>>  >  > Hi,
>>  >>  I'm using :
>>  >>  - Win NT 4.0 SP6
>>  >>  - Apache 1.3
>>  >>  - PHP 4.05
>>  >>  - MySQL 3.23
>>  >>  When I try to upload JPG files, the temporay files on the
>>  server are OK.
>>  >>  But when I store them into a BLOB field into mySQL, some
>>  images (not all)
>>  >>  are truncated after some lines.
>>  >>  It's like an EOF byte found ...
>>  >>  The SQL is:
>>  >>  $reqSQL = "UPDATE RESSOURCE SET NOM='".$fichier."'
>>  >>  ,EXTENSION='".$extension."' ," ;
>>  >>  $reqSQL .= " DATA=LOAD_FILE('".$ficherRessource."') WHERE
>>  >>  ID_RESSOURCE=".$id_ressource;
>>  >>
>>  >>  No problem with GIF files, and small JPG.
>>  >
>>  >Check the value of max_allowed_packet. You will probably find that
>>  >your images are truncated to about this size.
>>
>>
>>  Does max_allowed_packed apply to values loaded with LOAD_FILE()?
>
>Reading The Fine Manual sec. 6.3.2: (sorry, couldn't resist :-) )

Hey, that's no fair - countering with *facts*!

>
>     LOAD_FILE(file_name)
>         Reads the file and returns the file contents as a string. ...
>         The file must ... be smaller than max_allowed_packet.

Huh.  You're right.  I was thinking that because the file has to be
on the server host, the server could read it directly and thus the
contents wouldn't be subject to the network-traffic max_allowed_packet
size.

>
>>  The truncation might be enforced by the Web server rather than MySQL.
>>  For example, CGI.pm has a $POST_MAX variable that controls the maximum
>>  amount of information that can be sent back to the script.
>
>This was my first thought as well; However, Hervé does state
>that the temporay files on the server are OK.
>
>/ Carsten
>--
>Carsten H. Pedersen
>keeper and maintainer of the bitbybit.dk MySQL FAQ
>http://www.bitbybit.dk/mysqlfaq


-- 
Paul DuBois, paul@stripped
Thread
Problem with BLOB and JPG filesHervĂ© Debeire5 Sep
  • RE: Problem with BLOB and JPG filesCarsten H. Pedersen5 Sep
    • RE: Problem with BLOB and JPG filesPaul DuBois5 Sep
      • RE: Problem with BLOB and JPG filesCarsten H. Pedersen5 Sep
        • RE: Problem with BLOB and JPG filesPaul DuBois5 Sep