Multiple image upload

Discussion in 'PHP' started by Om ji Kesharwani, Oct 22, 2009.

  1. #1
    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? :)
     
    Om ji Kesharwani, Oct 22, 2009 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    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:
     
    mastermunj, Oct 22, 2009 IP
  3. organicCyborg

    organicCyborg Peon

    Messages:
    330
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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.
     
    organicCyborg, Oct 22, 2009 IP
  4. dhaval300

    dhaval300 Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this attachment will give u better idea.....
     

    Attached Files:

    dhaval300, Oct 22, 2009 IP