I want to make a photo gallery by using php. Please help me for uploading multiple selected image at once and save image path to mysql. I can upload single image but tell me what to do for uploading multiple images. Do i need Ajax for it?
following should be helpful.. <?php if(isset($_POST['submit'])) { for($i = 0; $i < count($_FILES['upload_file']); $i++) { echo $_FILES['upload_file']['name'][$i] . "<br/>"; } } ?> <html> <body> <form id="upload" method="post" action="upload.php" enctype="multipart/form-data"> <table> <tr> <td> <input type="file" name="upload_file[]" /> </td> </tr> <tr> <td> <input type="file" name="upload_file[]" /> </td> </tr> <tr> <td> <input type="file" name="upload_file[]" /> </td> </tr> <tr> <td> <input type="file" name="upload_file[]" /> </td> </tr> <tr> <td> <input type="submit" name="submit" /> </td> </tr> </table> </form> </body> </html> PHP:
Give this a try if you can: http://swfupload.org/ It's in flash, but you can use it with any PHP script you like. I haven't used it (yet), but it looks pretty neat.