tags:

views:

117

answers:

2

Im working with a friend to recieve image uploads from his C# program to my php script. Hes sending the form data and image as an HTTP POST method.

The text comes through fine, but when the image comes through, it doesnt show up in $_FILES, but in $_POST.

when i print_r $_POST and he submits, he gets this...

Array
(
   [dbto] => sometext
   [blurb] => somemoretext
Content-Disposition: file; name="userfile"; filename="picture.png"
Content-Type: IMAGE/PNG

?PNG

Then his app crashes. I read something about a possible bug in php when handling this kind of transaction, something about the way the data is being sent.

Any ideas if this is a known issue or something i can do on my side?

+2  A: 

when sending files with form (i'm not sure if its a form) it has to be encoded.

a form tag should have the enctype="multipart/form-data" this should post the data the right way

Robert Cabri
+2  A: 

if the sender can't encode it properly, then you can receive it by opening and reading 'php://input':

$fp = fopen('php://input');
//or
$file = file_get_contents('php://input');

(if the POST is encoded though, this won't work)

Greg