Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Uploading "blank" photo to photoalbum, without an attachment??

I have a strange problem that I never noticed before. I've combed the forums to see if anyone else has reported it. But I've found nothing.

I have both user photo albums and photo albums on my site. When I go to the add a photo page of EITHER one and just click save photo, without adding any data or attaching a photo, it creates a BLANK photo and database entry.

Why would that be?

Shouldn't it give an error like, "you haven't attached a photo, please try again" or something.

I'm going to have people making blank photos all over the place.

Using v6.01.15

Anyone else deal with this?
Photos submitted via the submit.php have proper field validation to avoid submitting blanks.

Photos submitted via the admin section do not have proper field validation and you can submit blanks.

So any blanks should be your own or from some of your co-admins. :)
I have the user photo album infusion set up so that Every user has their own albums. I was surprised that this validation was absent. Silly users do all kinds of strange things. They can't even figure out how to DELETE the blank photo.

It took me a while to figure out how to ADD it to the validation code, but I did.

Replaced this:
CodeDownload  
elseif (isset($_POST['save_photo'])) {
   $error="";
   $photo_title = stripinput($_POST['photo_title']);
   $photo_description = stripinput($_POST['photo_description']);
   $photo_order = isNum($_POST['photo_order']) ? $_POST['photo_order'] : "";
   $photo_comments = isset($_POST['photo_comments']) ? "1" : "0";
   $photo_ratings = isset($_POST['photo_ratings']) ? "1" : "0";
   $photo_file = ""; $photo_thumb1 = ""; $photo_thumb2 = "";
   $photo_pic = $_FILES['photo_pic_file'];
   



With this:

CodeDownload  
elseif (isset($_POST['save_photo'])) {
   $error="";
   $photo_title = stripinput($_POST['photo_title']);
   $photo_description = stripinput($_POST['photo_description']);
   $photo_order = isNum($_POST['photo_order']) ? $_POST['photo_order'] : "";
   $photo_comments = isset($_POST['photo_comments']) ? "1" : "0";
   $photo_ratings = isset($_POST['photo_ratings']) ? "1" : "0";
   $photo_file = ""; $photo_thumb1 = ""; $photo_thumb2 = "";
   $photo_pic = $_FILES['photo_pic_file'];
   $photo_name = strtolower(substr($photo_pic['name'], 0, strrpos($photo_pic['name'], ".")));
   if (($photo_name=='') AND ($action != "edit")) { $error = 5;}



Replaced this:

CodeDownload  
elseif ($error == 4) { $message .= sprintf($locale['425'], $settings['photo_max_w'], $settings['photo_max_h']); }



after this:
CodeDownload  
elseif ($error == 4) { $message .= sprintf($locale['425'], $settings['photo_max_w'], $settings['photo_max_h']); }
elseif ($error == 5) { $message .= $locale['428']; }



And created a new error numbered 428 in: LOCALE.LOCALESET."admin/photos.php";

Probably a sloppy solution as I am not a real programmer, but it works.
It's the same problem in v7, so you could submit it to the bug tracker and see if they wish to fix it.
Thread Information
Author
Replies
4 posts
Views
1,698 times
Last Post
Last updated on 11 years ago
You can view all discussion threads in this forum.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You cannot download attachments in this forum.