Requiring a Title for Upload Requiring a Title for Upload
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Requiring a Title for Upload

Started by GarryS, September 20, 2012, 07:03:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GarryS

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.


Jeff Bailey

If using HTML Single File Upload something like this should work.

In db_input.php
find:

    $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:

    if ($title == '') {
        cpg_die(ERROR, 'Title Required', __FILE__, __LINE__);
    }
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

GarryS

I checked that out and it works just as hoped.

Once again this great forum has provided the desired solution.

Thank you, Jeff.