How to process images sent by a mobile device?

One of my colleagues is developing an application for the iPhone that will allow users to post images to my site through my API. I am creating a part of the API that will receive and process images.

The mobile developer sends the following headers:

Content-Disposition: form-data; name="photo_1"; filename="photo_1.jpg"
    Content-Type: application/octet-stream

When searching for submitted images, is this the same method as for regular HTML forms? Should I search for $ _FILES?

Or using PHP, how would I find its image?

+2
source share
3 answers

Its submission through the form is not displayed, i.e. <form enctype=multipart/form-data">and <input type="file">therefore the array $_FILESwill not be filled.

You probably need to read:

$HTTP_RAW_POST_DATA

or do:

$rawPost = file_get_contents("php://input");

From manual :

php://input . POST-, $HTTP_RAW_POST_DATA, php.ini. , , $HTTP_RAW_POST_DATA always_populate_raw_post_data. php:// ENCTYPE = "/-".

:

http://php.net/manual/en/wrappers.php.php

http://php.net/manual/en/reserved.variables.httprawpostdata.php

+2

, iOS POSTDATA HTTP-. POSTDATA ( ):

<?php
$postdata = file_get_contents("php://input");
?> 

$_FILES , enctype="multipart/form-data" HTML. iOS, , POST, , .

, !

+1

All Articles