uploading a whole folder

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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

uploading a whole folder

Post by s.dot »

I have a form where a user could upload a picture, then another one, then another one, a single picture at a time.

However, one of my clients is going to be uploading up to 100 pictures at a time.

Even with a form for selecting 100 pictures, this would be tedious.

So I'm going to attempt to make a script to upload a whole folder at a time.

My logic:

1.) File upload form where the browse button selects folders, not files
2.) Pick out all files ending in .JPG
3.) Loop through and upload

Sounds good.

However, is there an HTML form that selects directories (I've never ran across one while coding)?

Picking out only .JPG files, should be easy.

Looping through them, brings me to a question.. I can't use readdir() can I? It seems that readdir is for an already existing directory on the server. How would I go about looping through the files?

Is this beyond the scopes of PHP?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

can't be done, php is server, files are on the client.

I posted about 6 months ago almost this very question, using HTML and http as the protocol, you're stuck doing only one at a time unless you write some kind of java applet, or flash, or activeX control they can install on their machine that would give you access to their file system. Can you have them just ftp the files/folder to the server, then do your scripting on the folder once it's there?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

SCORE! Free lunch for me.

Unless you count the 8O in your sig ;/
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

lol, nice work!

8O

edit: pm me your paypal details :oops:
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

My Paypal is... inacessable :))

I haven't logged in in forever

I accept personal check or MO
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

well then I guess you're foobar'ed
:wink:
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

SCORE!
Free lunch AGAIN!?

Edit: Is there a rule for off-topic-ness?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

neg, it's done by topic, and I already put it in your topic.

/me thinks this may have been a bad idea.

unfrozen caveman lawer might return sooner than later...

edit:
Edit: Is there a rule for off-topic-ness?
not sure, but we've most definitely violated it if there is...back to "real" discussions....
Post Reply