I am trying to develop a photo upload system for my website. Currently I have to upload each photo one at a time, with comments etc, into a database. This works fine, but I'd like to be able to upload all the photos at once and then write a script to comment on the photos thereafter.

All I need help with is the best way to create a simple interface to upload the files. What is the quickest way? POST? FTP? Something else?

Many thanks for your help!

Rupert

    a very basic example:

    <?php
    if (!isset($_POST['submit']))
    {
    	echo '
    	<form action="" method="POST" enctype="multipart/form-data">
    	file 1: <input type="file" name="1"><br>
    	file 2: <input type="file" name="2"><br>
    	file 3: <input type="file" name="3"><br>
    	<input type="submit" name="submit" value="submit">
    	</form>
    	';
    }
    else
    {
    	echo '<pre>'; print_r($_FILES);  echo '</pre>';
    }
    ?>
    

      Thanks, but the number of files to upload will vary every time, so I need something to pick them all up and dump them in a particular directory and add them all as new entries in a database.....or the database bit can be done afterwards thinking about it.

        This is meant to be an easy way of doing it.
        I just want to be able to select up to 50 image files and upload them to a remote webserver.......rather like you see on digital photo printing websites.

          How about using javascript to auto generate however many upload fields you want? (sort of like how gmail lets you add attachments).

            theslinky's approach probably sounds like what you're after.

            You could also give all of the file elements a name such as "image[]" so that PHP creates the array $_FILES['image'] which a simple [man]foreach/man loop would iterate through and process each file uploaded.

              Write a Reply...