Going crazy about binary post

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hey all,

I'm tearing my hair out over this one.. I'm using EasyPHP, and trying to
write a script which receives binary POST data from a client program of
mine. I've put together a simplified example which demonstrates the
problem. The data looks like this:

(String showing the length of the following binary)(Character
#10)(Binary data)

My PHP script looks like this:

   $chandle = mysql_pconnect($servername, $username, $password) or
   mysql_select_db($database, $chandle) or die ("FAIL");

  $handle=fopen("php://input","rb") or die("FAIL");



  $query="INSERT INTO ".$table." (Picture) VALUES ('".$picture."')";
  mysql_db_query($database, $query) or die("Failed Query");


Although I get the right number of bytes in my MySQL database, they're
corrupted! What setting am I missing here? The files being stored are
less than 40k in a MEDIUMBLOB field.

Nicholas Sherlock

Re: Going crazy about binary post

Puzzling. It might have something to do with the
encoding. What kind of files are you inserting?

More likely, though, it is a bug specific to
EasyPHP, perhaps due to compilation issues.
Can you try running your code on a Linux box?


Re: Going crazy about binary post

Felix wrote:
Quoted text here. Click to load it

GIF images. It's got me beat as well.

Quoted text here. Click to load it

I don't have one available.. I'll try updating the individual components
of EasyPHP.

Nicholas Sherlock

Site Timeline