upload a folder, not a single file or multiple uploads

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
revbackup
Forum Commoner
Posts: 29
Joined: Tue Jun 09, 2009 1:52 am

upload a folder, not a single file or multiple uploads

Post 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....
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

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

Post 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
}
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

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

Post by Skara »

Actually you can upload a folder--just not in php. It's possible in Java.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

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

Post 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.
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

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

Post by Skara »

Haha, I think the point is how the user interfaces, not how the code actually looks. :lol:
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

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

Post by requinix »

Skara wrote:Haha, I think the point is how the user interfaces, not how the code actually looks. :lol:
Wanna bet? ;)
revbackup
Forum Commoner
Posts: 29
Joined: Tue Jun 09, 2009 1:52 am

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

Post 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??
Post Reply