I'm trying to use the Picasa Web Uploader API to upload galleries of photos to my website. I've been able to implement the button, get it set up in Picasa and get authentication working, but when it comes to processing the POST received by my site from Picasa the $_FILES
array is always empty.
I've had a look at the request posted by Picasa using Fiddler, and have been able to identify that the Content-Disposition
header at the start of each file multipart is too long - the header sent through by Picasa includes the full path to the file on my server, so it ends up being far more than 128 characters:
Content-Disposition: form-data; name="http://localhost:50216/1f6b3b29edc6f9d8898ede07c1b10e27/image/415603f72f75af1a.jpg?size=640"; filename="DSC_0055.JPG"
It seems that PHP can only handle headers up to 128 characters, and that the whole multi-part section is discarded if the header is too long. (When I reduce the length of this header in Fiddler and re-post the request, my website receives the $_FILE
and handles it successfully).
How can I work around this?
You're screwed.
But you can use a couple of workarounds to achieve it anyway. You'll need to parse the received form data yourself. Another problem is that PHP won't let you see the raw mutlipart/form-data, so you need:
file_get_contents("php://stdin")
The alternative is to patch the PHP interpreter. :/