forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: GarryS on September 20, 2012, 07:03:38 pm

Title: Requiring a Title for Upload
Post by: GarryS on September 20, 2012, 07:03:38 pm
My site URL is http://www.victoriacameraclub.org/vcccompetitions/

Our camera club has successfully implemented our competitions on Coppermine. Recently, on Sept.11, 2012, this forum provided invaluable assistance in establishing checks on both the pixel width and height to restrict upload of oversized images.

We require that a title be entered in order for an image to be judged. Currently, entry of a title is an option but the lack of a title does not create an error message or stop the upload.

In the same manner as was provided in the previous case, above, it would be much appreciated if a bit of code to prevent the upload of an image without an entry in the Title field could be provided.

I assume that it would involve a test for a null value, the aborting of the upload and the generation of the error message, with wording such as "The image does not have a title."

Once again, thank you for your help.

Title: Re: Requiring a Title for Upload
Post by: Jeff Bailey on September 20, 2012, 09:52:31 pm
If using HTML Single File Upload something like this should work.

In db_input.php
find:
Code: [Select]
    $album = $superCage->post->getInt('album');
    $title = $superCage->post->getEscaped('title');
    $caption = $superCage->post->getEscaped('caption');
    $keywords = $superCage->post->getEscaped('keywords');
    $user1 = $superCage->post->getEscaped('user1');
    $user2 = $superCage->post->getEscaped('user2');
    $user3 = $superCage->post->getEscaped('user3');
    $user4 = $superCage->post->getEscaped('user4');
below it add:
Code: [Select]
    if ($title == '') {
        cpg_die(ERROR, 'Title Required', __FILE__, __LINE__);
    }
Title: Re: Requiring a Title for Upload
Post by: GarryS on September 20, 2012, 10:25:23 pm
I checked that out and it works just as hoped.

Once again this great forum has provided the desired solution.

Thank you, Jeff.