|
Posted by Lee on 12/08/19 11:52
There is something I didn't mention: I am getting the POST from a java
applet, not a form.
What's happening is that I created a jpeg inside the program, made a
string out of it, converted it with urlencode, and then made a post
request.
On the php side, I want to decode it and write it to a binary file.
Gertjan Klein wrote:
> 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>
Navigation:
[Reply to this message]
|