Jump to content

multiple file upload


Recommended Posts

I've used http://swfupload/ quite a bit - if you're needing this to be something that you'll do on a regular basis and want to have some automation in the processing, or if and end-user will be doing these uploads, I'd recommend it.  It allows you to upload multiple images at a time, gives you the ability to display a progress bar as they are uploading, and delivers them one at a time to your PHP script.  You need to work with the javascript but you technically can use the sample codes to get a pretty decent uploader.

Link to comment
Share on other sites

Should be something like

<form method="post" target="server" action="upload.php" enctype="multipart/form-data">
<div>file1: <input size="50" type="file" name="files[]" /> </div>
<div>file2: <input size="50" type="file" name="files[]" /> </div>
<div>file3: <input size="50" type="file" name="files[]" /> </div>
...
<input type="submit" value="upload" />
</form>

 

# upload.php
for($i=0, $n=count($_FILES['files']['name']);$i<$n;++$i){
  if (false == my_upload_file($_FILES['files']['tmp_name'][$i], ...)){ 
    error_log($_FILES['files']['error'][$i]);  
  }
}

 

You should also check if e.g. $_FILES['files']['name'] is array

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.