Jump to content

Recommended Posts

Hi Guys,

 

I been googling every where to find some code sample that will enable me to upload multiple photos from an iphone running IOS 6 to a website. According to what I had read, Safari for IOS supports this by using a mutiple boolean value in an input tag. And that works fine. When the button is pressed to select pictures I am able to select multiple pictures, what I can't seem to figure out is how on the server side I can grab those multiple images selected. Here is code sample( I found online not mine) that I was able to use . And it works fine with 1 image; I can upload the image. But with 2 or more I can't seem to figure out how to make it happen. Thank you.

 


<?php
$result=0;
if (trim($_POST["action"]) == "Upload File") { //**** User Clicked the Upload File Button

//*********** Execute the Following Code to Upload File *************
$imagename = basename($_FILES['image_file']['name']); // grab name of file
$result = @move_uploaded_file($_FILES['image_file']['tmp_name'], $imagename); // upload it
if ($result==1) echo("Successfully uploaded: <b>".$imagename."</b>"); // did it work?

} // end if
?>
<html>
<head>
<title>Upload file script</title>
</head>
<body>

<form method='POST' enctype='multipart/form-data' name='frmmain' action='up2.php'>
Browse for Image (jpg): <input type="file" name="image_file" size="35">
<br>
<input type="submit" value=" Upload File " name="action" multiple>
</form>
<br>
<?php
if ($result==1) echo("<img src='".$imagename."'>"); // display the uploaded file
?>
</body>
</html>

 

Can any one help me figure out how I can make this happen?

Link to comment
https://forums.phpfreaks.com/topic/273248-ios-60-safari-multiple-photo-upload/
Share on other sites

You need to check out the $_FILES array, in order to find the information you're looking for.

 

I recommend reading the Handling file uploads section in the PHP manual, for more information on how to properly handle uploads. Also, remember to properly validate your input, and make sure that the pictures are indeed pictures.

This last part can be done with the GD functions.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.