Never tried that, But i'm afraid that by reading a binary file like:
join('', file('binfile'))
will brake the file!

try using fopen('binfile', 'rb') and fread() and filesize()

good luck.

"Daniel Reichenbach" <[EMAIL PROTECTED]> wrote in message
000001c17111$02617a50$796010ac@danielmob">news:000001c17111$02617a50$796010ac@danielmob...
> Hy,
>
> I'm trying to post image files to a php script with another php script.
> Don't ask why, it's a crazy project :)
> Now the file is around 28000 bytes but the post receiver only gets
> around
> 300 bytes. Has anybody experienced this behaviour?
>
> I use the following script:
>
> --- snap ---
> <?
> // the receiver of file
> $remote_page = "http://www.server.com/post.php";;
>
> // the file to upload
> $file = "/var/www/test/dummy.jpg"; // the file location
> $con_type = "image/jpg"; // the file mime type
> $content_file = join("",file($file));
>
> // define boundary
> srand((double)microtime()*1000000);
> $boundary =
> "---------------------------".substr(md5(rand(0,32000)),0,10);
> $data = "--$boundary
> Content-Disposition: form-data; name=\"userfile\"; filename=\"$file\"
> Content-Type: $con_type
>
> $content_file"."--$boundary--\r\n\r\n";
> $msg =
> "POST $remote_page HTTP/1.0
> Content-Type: multipart/form-data; boundary=$boundary
> Content-Length: ".strlen($data)."\r\n\r\n";
>
> $f = fsockopen("www.server.com",80);
> fputs($f,$msg.$data);
> $result = fread($f,32000);
> fclose($f);
> print $result."\n<br>";
>
> ?>
> --- snap --
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to