Hi folks... I'd like to add a small function to admin/plog-upload.php to just check that there isn't already a file with the same name in the target album... Plogger doesn't seem to like that very much...
I'll need something in the
// Check if update has been clicked, handle erroneous conditions, or upload
section like this:
else if ($_FILES["userfile"]["name"] == " ***the name of a file in the target album*** "){ $output .= '<p class="errors">That file already exists!</p>'; }
but I just can't get my head around the function that checks the filenames... I'm not sure where Plogger keeps the function that does this... Anyone better acquainted with the dear piece of software than I am that can point me in the right direction?
if (file_exists($sysfolder . '/' . $filename)) { // append a digit to the beginning of the name $tmpVar = 1; while(file_exists($sysfolder . '/' . $tmpVar . '-' . $filename)) { // and keep increasing it until we have a unique name $tmpVar++; } $filename= $tmpVar . '-' . $filename; }
again, obviously, not my code, but pinched shamelessly from another helpful poster elsewhere... This is kind of fun, I'm gonna keep trying, hopefully learn some more code on the way.
Looks good, though I would append to the end, so that when you sort by filename, all of the filenames that began together stay together (e.g. all the "soccer" or "platapus" photos are grouped together).
true... but not so much at the end that it adds it after the file extension causing problems... so we have to look at the name, determine how many . there are, and put it before the first one? or is it enough to just put it before the .
keeping those platypuses together sounds like a good idea though, I'm not sure I'd like them to all be wandering around just anywhere :-s
anyway, it's not working as of yet, I'll let you know if i get it to... Not sure that $sysfolder is correct...