I'm working on a gallery remote client for the Danger Hiptop camera phone and have run into a problem with the add-item call: when I base64-encode the image, I get the following error in the response:
status=403
status_text=Upload failed: 'Invalid image: userfile.jpg'.
and this error in the httpd error log:
/usr/bin/identify: Not a JPEG file: starts with 0x2f 0x39 (/var/www/html/albums/test/userfile.jpg).
The image part I am sending is:
---677507349-1098744548629
Content-Disposition: form-data; name="userfile"; filename="userfile.jpg"
Content-Type: image/jpeg
Content-Encoding: base64
/9//4AARSkZJRgABAQEAAAAAAAAK/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4d
(etc.)
Unfortunately, I don't have the option of sending the image in 8bit encoding because the phone's proxy is rejecting binary parts. Is a base64-encoded MIME part supposed to be automatically decoded by PHP before it is written to disk? If not, where can I detect the encoding and run the base64_decode function on it?
Thanks for the help!
p.