PHP photo gallery with multiple upload form
I am trying to develop a PHP driven gallery with a form that has at least four file upload boxes, each with its own title and caption. I have been using php.upload.class to process uploaded photos but not sure how I would go about handling each individual upload while preserving its details (title, caption).
Is there a practical way to do this or should I instead upload just the photos and then have the user add titles and captions on the next page? Any help/suggestion would be great开发者_运维百科ly appreciated.
Thanks!
This is my suggestion, you can use this jquery multiupload file to ease of to multi uploading file plus better interface rather than to organize multi input boxes.
you can use this is image resizer to dynamically resize your picture rather than to create another file, it will cache your picture then some sort of up a little bit perfomance. Just go to the site and only download 1 image.php file. There will be example that you can test and play of.
For the caption, suggest that you will make something like display all file list and multi update at once, sorry i don't really have much time for doing it myself but this is what I will do many times.
Here's a simple breakdown of what I would do:
- Have multiple file boxes (four in this case), each with its own unique name (file1, file2, etc).
- Have similar named text boxes for title and caption
- When processing the files, I would do something like this:
- Upload file 1
- Store caption one
- store title one
I'd do that inside of a for-loop starting at 1 and going to the end of the $_FILES array
UPDATE 1
for($i = 0; $i <= $num_files; $i++) {
$file = $_FILES["file1"];
move_uploaded_file($file, $file_destination)
// store caption and title code here
}
?>
Something like that. I don't know anything about the class you're using so I can't really help you there.
精彩评论