Jump to content

Upload an entire folder?


dooper3

Recommended Posts

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!
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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!
Link to comment
Share on other sites

[!--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. :)
Link to comment
Share on other sites

[!--quoteo(post=374279:date=May 16 2006, 03:11 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ May 16 2006, 03:11 PM) [snapback]374279[/snapback][/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...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.