Jump to content


Photo

Upload an entire folder?


  • Please log in to reply
5 replies to this topic

#1 dooper3

dooper3
  • Members
  • PipPipPip
  • Advanced Member
  • 161 posts
  • LocationLondon, UK

Posted 16 May 2006 - 11:40 AM

I have made a photo gallery that lets members upload their photos to the relevant gallery and then uses GD library to create a thumbnail and resize the original image if too big. At the moment, for people to upload, they can do so with 20 files at a time, which is a pain if you want to upload say 100! Is there a way to select a folder to be uploaded rather than an individual file?
Thanks!
Personal: charliehawker.com
Educational: fantasticode.com

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 16 May 2006 - 11:55 AM

I've had a google and not come across anything PHP (Or even webbased in general) to upload a folder Thru a form.. Would say FTP but that's hastle on the customers side or aless you generated a script the cmr could download and run after selecting where on there computer the files are store then you could script a file to ftp into your server and upload the entire file thru ftp commandline but this is still going to be pretty hard...

Anyone else got any ideas?

Regards
Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 16 May 2006 - 12:02 PM

Maybe you could instruct your users to compress their images into a zip archive and have them upload that - You can decompress them with PHP and then loop through the contents. Not exactly user friendly though is it...

I'm no expert in JavaScript (I'm still picking it up as and when I need it), but does it have file functions? If so, maybe you could use them to select the directory and dynamically create a some pre-filled file input boxes in a hidden div or something?

Whatever method you choose, you must take maximum file size limits into consideration with PHP, as I think the default limit is set at either 2MiB or 8MiB, unless you have the power to alter this on your server.

#4 dooper3

dooper3
  • Members
  • PipPipPip
  • Advanced Member
  • 161 posts
  • LocationLondon, UK

Posted 16 May 2006 - 12:07 PM

Hmmm... Frustrating! It's not too much of a bother about making people do things before they upload because it's not a customer who'll be doing it. It's for a University sports club website, and it's just the club members who'll be uploading images, but I don't trust all of them to know how to zip up a file. It seems strange you can't tell PHP to upload an entire folder, I hope someone out there has a workaround, otherwise i'll just have to keep uploading one by one.... damnit!

Thanks for replies so far!
Personal: charliehawker.com
Educational: fantasticode.com

#5 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 16 May 2006 - 02:11 PM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]It seems strange you can't tell PHP to upload an entire folder[/quote]
Think about it. Directories (folders as you call them) are located on the client, php is located on the server. How is php to know what is contained within a directory?

Im afraid the only solutions have already been mentioned. Either zip or ftp. Of course both rely on your clients not being complete idiots which unfortunately is not the best thing to rely on. :)

#6 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 16 May 2006 - 07:08 PM

[!--quoteo(post=374279:date=May 16 2006, 03:11 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ May 16 2006, 03:11 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Think about it. Directories (folders as you call them) are located on the client, php is located on the server. How is php to know what is contained within a directory?

Im afraid the only solutions have already been mentioned. Either zip or ftp. Of course both rely on your clients not being complete idiots which unfortunately is not the best thing to rely on. :)
[/quote]

there is one other solution, but not strictly php.
i wish i had the link, but there's a few java applets that sit very nicely in your website that allow multiple file uploads/folder uploads/previews, etc which can be easily integrated into php. if i come across the links, i'll post back...
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users