Let me first start by saying that I love Plogger! That said I am trying to find a solution to allow users to upload their own photos. What I have so far is a file upload form that dumps the file in the /uploads/ directory. I then have to go into the admin panel and 'import' the file (photo). This is fine and actually works very well.
In addition to that what I want to do is add a comment field to that form that will populate the photo comments. Currently I would have to add any comments during the 'import' session. It would be much easier and more streamlined if the user could enter there on comments in a form field and have that photo comments. Any ideas or suggestions on how I might do this?
I would greatly appriciate any help on this.
By the way here is my upload form: http://plogger.nathansnipes.com/plupload/plupload.html
Here is the gallery: http://plogger.nathansnipes.com
############################# <?php define ('IMAGES_PATH',"/********/plogger.nathansnipes.com/uploads/"); // make sure that your scripts have write privileges to this path!!! $filename = $_FILES['filename']['name']; $tmp_filename = $_FILES['filename']['tmp_name'];
if ($tmp_filename) {
// test to make sure the file is of the correct file type $filename_array = explode(".",$filename); $type= $filename_array[1]; if ($type!="gif" & $type !="jpg" & $type!="png") { die ("File type not recognized as a .gif, .jpg, or .png"); } else {
$newfile = IMAGES_PATH.$filename; // setup destination filename if (!file_exists($newfile)) { @$result = move_uploaded_file($tmp_filename,$newfile); // @ used to suppress error messages // move_uploaded_file also has a security feature built in to only move files that are HTTP posted uploads.
if (!$result) { die ("Unable to move file."); } else { echo "Congradulations: Your file was uploaded!"; } // end if - !$result
} else { die( "Sorry, but that file '$newfile' already exists."); } // end if - file_exists } // end if - $type
} else {
die("No Filename Provided."); } // end if - $tmp_filename ?> #############################
Does anyone know how I can tap into the comments? I want to be able to have a field that populates the comment for the photo. Anyone?
thanks nsnipes for the code as for the comments, I hope someone helps us in here. For now, I ask users, in a text I've added above the form, to re-name the pic file, before uploading it, with a descriptive comment of their choosing. This serves 2 ways: - for me to get the comment out of the file name - it also gives the picture page a friendly URL, instead of the common digits that pic files are often named with: http://www.egyptpix.com/upload.html
my problem is that I want users to be able to add comments that are much longer. Hard to do with a file name. Hopefully someone has some idea of how to do this.