i am trying to do multiple photo upload but its not working,i can just upload just one image at a time
here is my code.I am looking for uploading multiple image using multiple file input type and a single submit button.

<html>
<body>
<form action="imgupsuc.php" method="post" enctype="multipart/form-data">
<?php
    @$nm=$_POST['n1'];
?>
<input type=hidden name=n1  value=<?php echo $nm ?>>
Select a picture<input type="file" name="file" size="50">
Select a picture<input type="file" name="file" size="50"><input type="submit" value="upload">

</form>
</body>
</html>

imgupsuc.php

<?php
    session_start();
    include "connect.php";
?>
<?php
    $name=$_POST['n1'];
    move_uploaded_file($_FILES['file']['tmp_name'],"./pic/".$_SESSION['userid']."".$_FILES['file']['name']);
    $q="insert into image values('".$name."','".$_SESSION['userid']."".$_FILES['file']['name']."','".$_SESSION['userid']."')";
    $s=mysql_query($q);
    if($s>0)
        echo "<h1> pic insert successfully";
    mysql_close();
?><li>Go Back to Choose another photo to upload</li><b>or</b>
<a href="view.php">View Album</a>Or <a href="fileup.php"> Upload Another Image</a>

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.