0
How do I get this script to receive multiple images, at the moment it only takes one at a time.
<?php
include 'connection.php';
$album_id = $_GET['album_id'];
if ($_FILES['photo']['name'] != null)
{
move_uploaded_file($_FILES['photo']['tmp_name'], "images/". $_FILES['photo']['name']);
$photo_link = "images/". $_FILES['photo']['name'];
$upload_photo = $mysqli->query("INSERT INTO gallery_photos (album_id, photo_link) VALUES ($album_id, '$photo_link')");
if ($upload_photo)
{
header("Location: view-album.php?album_id=$album_id&upload_action=success");
}
else
{
echo $mysqli->error;
}
}
else
{
header("Location: index.php");
}
?>;
arquivo de upload_photo.php
<form method="post" action="upload_photo.php?album_id=<?php echo $album_id ?>" enctype="multipart/form-data">
<label>Add photo to this album:</label><br>
<input type="file" name="photo" />
<input type="submit" name="upload_photo" value="Upload" />
</form>
<?php
if (isset($_GET['upload_action'])) {
if ($_GET['upload_action'] == "success") { ?>
<br><br>Photo successfully added to this album<br><br>
<?php }
}
?>
Related: https://answall.com/questions/121377/upload-multiplas-photos-com-subtitles
– novic