简体   繁体   中英

multiple images should be uploaded from iphone to a php server

multiple images should be uploaded from iphone to a php server and images will be sent to php server as an http request.

something like this www.ursite.com/event_id=1234qwer&method=upload&data=!@#$%^&*&^%$#@!!....

data=!@#$%^&&^%$#@!!&&(&&$$%$@$@GFGF%$4....

it would a random value and it is packet of data[images]. We need to read this raw data using php

how can I do that??

http://pastebin.com/WAp5AV5Y

You shouldn't be sending your data as a GET request, you should be sending it as a multipart POST call. There's plenty of resources about that over the web, SO included. Also check out this page .

On the PHP side you will receive the uploaded files in the $_FILES array just as if the user uploaded the images from a HTML form so you don't need to do anything special to handle an iPhone upload.

I have some good news, and I have some bad news.

The good news is that the image data is just a JPEG, so GD's imagecreatefromstring will do the job nicely to ensure that the data is a valid image.

The bad news is twofold:

  1. The data has come in without the benefit of URL-encoding, so it is surely corrupt.
  2. GET method requests have a relatively small available data size.

You will need to have the data submitted as a POST, properly encoded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM