PHP upload entire folder of files?

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
boon4376
Forum Newbie
Posts: 19
Joined: Sun Oct 01, 2006 9:55 pm

PHP upload entire folder of files?

Post by boon4376 »

So I want to be able to have my users upload entire folders of images to the server.....
I know I cant create an upload form and have them just select an entire folder, but I have a few ideas about how to accomplish this task and I want some input..

Ideas:
1.) Have the user zip the folder, have them upload it through the form, and then have PHP unzip the folder and put it where it needs to go

2.) I'm not sure if this will work at all.... Can I use java script to somehow scan the folder than the user has selected on their computer, have it load all of the file names into an array, then have PHP create a new folder on my server and upload the one by one all the the files in the array on its own?

Idea 1 seems easy as I already have the zip library running in another part of my code, but requires more work on part of the user, which I want to avoid. Anyone have input of other ideas that are easy to implement?
boon4376
Forum Newbie
Posts: 19
Joined: Sun Oct 01, 2006 9:55 pm

Re: PHP upload entire folder of files?

Post by boon4376 »

just bumping this up to page 1 again....
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: PHP upload entire folder of files?

Post by Darhazer »

1 is the way, at it is easily implementable with PCLZip... I even have such working code, that works with a directory tree in the ZIP file (not single folder)

You cannot scan files with JavaScript and you cannot upload multiple files at once with HTML page (unless you do not use multiple inputs, but the user will have to select a file for each one). However with Flash, user can select multiple files at once (and as far as I know, that the way GMail does it under Windows)
Post Reply