1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Renaming images on upload?

Discussion in 'Templates, HTML, CSS, and Design Help' started by bowers01, Nov 2, 2015.

  1. bowers01 Genius At Work

    Hi,
    Does anyone know if it would be possible to rename images on upload to the title name?
    Cheers,
    Nick
  2. freeze2 Super Moderator

    Hey Nick, are you referring to the actual file name (example: title.jpg) or are you meaning the title field in the image upload section?
  3. Mike-N-Tosh Owner

    No, there is no built in way to set the actual filename to the entered title.

    I haven't tested this, but you may be able to this by customizing the includes/core/checkout/step5.php file.
    Always work from a copy of any php files!

    Around line # 94: find "$ppu = new pureFileUpload();" (without the quotes) put this above/before that line:
    PHP:
    // 2015-11-03 Modification to change the filename to the title
    $newFileName Filter::no_html($_POST['title']);
    $_FILES['imagename']['name'] = $newFileName;
    // End modification
  4. Mike-N-Tosh Owner

    Did this work for you, Nick?

    Bear in mind that if the new filename already exists the script will add to it to create a unique filename.
  5. bowers01 Genius At Work

    Sorry for the late reply, ill try it tonight.
  6. bowers01 Genius At Work

    sorry for wasting your time, i forgot i use template codes image uploader.
    cant find any common code in their module to place it in.

Share This Page