Advanced search  


cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.

Pages: [1]   Go Down

Author Topic: Requiring a Title for Upload  (Read 1945 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Requiring a Title for Upload
« on: September 20, 2012, 07:03:38 pm »

My site URL is

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

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1323
  • Fishing relaxes me.
    • Bailey Family Co.
Re: Requiring a Title for Upload
« Reply #1 on: September 20, 2012, 09:52:31 pm »

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

In db_input.php
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__);
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford


  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Requiring a Title for Upload
« Reply #2 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.
Pages: [1]   Go Up

Page created in 0.016 seconds with 21 queries.