Photo Gallery Bulk Uploading
One of the key upgrades to the PhotoGallery System is improving the way photos can be added. At the moment, the system is pretty basic and simply uploads the files individually using <input type="file"> input boxes.
There are various systems out there on commercial sites. Some of these include complex plug-ins that allow drag-and-drop, FTP utilities, and applets. These are all somewhat of a nuisance and require the user to download various bits and pieces to get them working. For a solution, I wanted something that would allow for multiple file uploads, be easy to use, and take a minimum amount of time to develop.
The quick and easy solution that I’m strongly leaning toward is actually incredibly simple. PHP has an excellent set of ZIP File functions. I quickly tested them last weekend and it’s as simple as compiling PHP with zip support, and using the little snippet of demo code on the PHP site. All the user will have to do is take all of the photos they want to upload, place them in a zip file, and upload the zip file to the website. Server-side, the photos are extracted from the zip file, processed, and a wizard allows the user to enter photo information. While not every end user knows how to zip a file, most do, and it’s relatively easy to learn. The only other concern is for Apple or Unix users, though there are functions out there for .sit and .tar files that I could incorporate later.
Has anyone else come up with a bulk-file uploading system, or have alternative ideas or suggestions?
view zip extraction demo
Code Sample
Zip File
259Kb
I already have a system working for allowing multiple dynamic file uploads with some simple DHTML, and PHP's ability to automatically create arrays for input fields named 'some_name[]'.
Is this little tip good enough for you to get started ?
--Joao
But no, my solution doesn't allow the user to select more than one file at a time. It would be nice if XForms (or the next generation of it) would provide this functionality.
Oh well :)
--Joao
Apple's Mac OS X has a zip utility built into it. Usage:
zip filename.zip file1...filen
For example:
zip petephotos.zip dog.jpg cat.jpg
It's command line driven, of course, so not as easy as it could me.
To solve this problem for posting to my own website, I wrote a brief AppleScript (OS X's secret weapon) that lets me drag and drop photos on an icon on my desktop, and then copies them to my webserver, resizes them if necessary, and copies HTML required to include them into a weblog post onto my clipboard, from where I can simply paste it as appropriate.
The disadvantages of this approach:
You have to embed the FTP username and password in the FTP link.
It depends on browser support, but most modern browsers now support drag and drop FTP uploads.
Peter, I'd already been considering doing the email attachment root. There were a couple reasons I prefered the ZIP file, but I might rethink that; the common knowledge of how to email is definetly attractive. That said, issues with associating email adresses with certain sites, and limits for sending attachments (Hotmail limits this to about 1Mb, receiving of course is not a problem) might cause a few problems.
Adam, I'm going to try out this iframe-FTP idea. I wonder what the browser support is.
Has anyone else had this problem?
My problem is exactly the oposite. At a party I took sevoral photos. Now I want to make them available on my website for download. My first idea was to let the visitor select the photos he want to have (stored in a database), have PHP zip them and finaly have PHP mail the zip-file to the visitor.
Anyone know how to do this?
Thanx in advance
Martin
We have created more marriages than any other [url=http://onlinedating-us.net/map.html]dating free sites[/url]. Get your free trial membership in [url=http://onlinedating-us.net/uk/map.html]UK dating site free[/url]!


