ppp
ppp

Reputation: 2055

zip image uploads

I'm writing a blog system (yes, I know I'm reinventing the wheel), and I want users to upload photos for their posts.

Up to now, in the form they filled to post a story, there was a field for the image, they selected and uploaded it.

Problem with that is that some stories may need more than one images, so I thought it would be easier to just let them upload a zip file containing the images, then the script unzips the contents, deletes anything non-white listed (.php files etc) and then goes ahead to process the images (create thumbnails, save the location in db etc..).

Is that a good practice?

If not, how can I handle the issue?

Upvotes: 2

Views: 571

Answers (3)

DaveE
DaveE

Reputation: 1643

With all modern browsers supporting uploading of multiple files through a single file input (http://www.w3schools.com/html5/att_input_multiple.asp ) this is probably your best bet. And it's easier to deal with on the back end.

You should also have a look at this excellent JQuery plugin. It may come in useful http://blueimp.github.com/jQuery-File-Upload/

Upvotes: 3

Eddy Freddy
Eddy Freddy

Reputation: 1816

You can upload more than one file with one upload form. Maybe add more files to the form with AJAX.

Other way: Let users upload their files to a media storage and then select the images for insertion while writing an article.

Upvotes: 0

casraf
casraf

Reputation: 21684

PHP has an official Zip library, learn it and use it! :)

Upvotes: 0

Related Questions