How can I handle long header declarations in PHP requests?

I am trying to use the Picasa Web Downloader API to upload photo galleries to my site. I was able to implement the button, configure it in Picasa and get authentication, but when it comes to processing the POST received by my site from Picasa, the array is $_FILESalways empty.

I looked at the request sent by Picasa using Fiddler, and was able to determine that the header Content-Dispositionat the beginning of each multipart file is too long - the header sent by Picasa contains the full path to the file on my server, so it ends with more than 128 characters:

Content-Disposition: form-data; name="http://localhost:50216/1f6b3b29edc6f9d8898ede07c1b10e27/image/415603f72f75af1a.jpg?size=640"; filename="DSC_0055.JPG"

It looks like PHP can handle headings up to 128 characters and that the entire multi-part section is discarded if the heading is too long. (When I reduce the length of this header in Fiddler and resubmit the request, my site receives $_FILEand processes it successfully).

How can I get around this?

  • Is it possible to set a configuration parameter somewhere so that PHP can process a long header and receive data in the $ _FILE array?
  • or, can I access the missing section of several parts in some other way than the $ _FILE array?
+3
source share
2 answers

You are screwed.

, . . , PHP mutlipart/form-data, :

PHP.:/

+3

, HTTP, http_get_request_body(), PECL, , :

$httpBody = @file_get_contents('php://input');

, , -, .

+1

Source: https://habr.com/ru/post/1779673/


All Articles