Page 1 of 1

upload a folder, not a single file or multiple uploads

Posted: Wed Jul 15, 2009 8:22 pm
by revbackup
hi,

what is the code to upload a folder or multiple files?
i have one that only uploads a single file at a time....
what i want to do is upload a folder or multiple files in one time....


please help me....

Re: upload a folder, not a single file or multiple uploads

Posted: Wed Jul 15, 2009 10:35 pm
by requinix
You can't upload a folder - only files.

For multiple files,

Code: Select all

<input type="file" name="upload[]">
<input type="file" name="upload[]">
<input type="file" name="upload[]">
ad nauseam

Code: Select all

for ($i = 0; isset($_FILES["upload"]["tmp_name"][$i]); $i++) {
    $name = $_FILES["upload"]["name"][$i];
    $tmp_name = $_FILES["upload"]["tmp_name"][$i];
    $error = $_FILES["upload"]["error"][$i];
 
    // do whatever you want
}

Re: upload a folder, not a single file or multiple uploads

Posted: Thu Jul 16, 2009 5:06 pm
by Skara
Actually you can upload a folder--just not in php. It's possible in Java.

Re: upload a folder, not a single file or multiple uploads

Posted: Thu Jul 16, 2009 7:34 pm
by requinix
Skara wrote:Actually you can upload a folder--just not in php. It's possible in Java.
...which works by uploading all the files in that folder individually. It's a wrapper, not new functionality.

Re: upload a folder, not a single file or multiple uploads

Posted: Thu Jul 16, 2009 8:50 pm
by Skara
Haha, I think the point is how the user interfaces, not how the code actually looks. :lol:

Re: upload a folder, not a single file or multiple uploads

Posted: Thu Jul 16, 2009 9:06 pm
by requinix
Skara wrote:Haha, I think the point is how the user interfaces, not how the code actually looks. :lol:
Wanna bet? ;)

Re: upload a folder, not a single file or multiple uploads

Posted: Mon Jul 27, 2009 5:19 am
by revbackup
if it's possible in java? can I use it or embed it in my php application???

I mean... the codes in my upload is java, but the rest stays PHP...

Is that possible??