Using file_get_contents() on multiple remote image POST

22 views Asked by At

Am testing my luck with the MIT App Inventor, and am trying to POST more than 1 image at a time to my PHP script to insert in a database. I have successfully POSTed 1 image, but can't seem to do more than just 1 with file_get_contents. I have tried

$remote_content = explode("\n", file_get_contents('php://stdin'));
file_put_contents($upload_dir . $filename, $remote_content[0]); //etc

but all of the images have 0KB. Have also tried looping (foreach), to the same lack of success.

Is there some alternative? Or should this be POSTed differently on the app's side? Right now, it's individually posted all at 1 time (so

if not is empty image1,
 postFile image1
if not is empty image2
 postFile image 2

etc.

0

There are 0 answers