|
Posted by Gertjan Klein on 07/08/06 10:52
Lee wrote:
>Hi, I am reading in a huge post request that represents an image with
>the php file below. The resultant file should be in jpg format, but it
>comes in weird.
[...]
>$imageString = $_POST['image'];
The fact that your image data is present in $_POST seems to suggest that
you didn't set the form's encoding type properly (unless something has
changed after version 4.1.2, which is what I'm using). When uploading
files, the form should look something like:
<form name=frm action="page.php" enctype="multipart/form-data"
method=post>
Note the encoding type of multipart/form-data. Now, information about
the submitted data from a file input is placed in the $_FILE array, as
Richard Levasseur mentioned. The file contents is already placed in a
temporary file.
>$fpImage=fopen($imageFile,'w+b'); //remove the binary?
Image data is binary data, so don't leave the "b" out.
HTH,
Gertjan.
--
Gertjan Klein <gklein@xs4all.nl>
[Back to original message]
|