Using Drupal 8, I want to rename and clean all the uploaded filenames. I want to convert all the spaces to dashes and make all the characters lowercase. A file named Screen Shot 2016-03-29 at 1.13.21 PM.jpg would become screen-shot-2016-03-29-at-1.13.21-pm.jpg.

I want to do this on the image upload dialog form used by CkEditor.

  • 1
    Try drupal.org/project/filefield_paths
    – user21641
    Commented Mar 29, 2016 at 9:50
  • filefield_paths works only for fields attached to content types. I want similar solution for inline images.
    – otarza
    Commented Mar 29, 2016 at 11:29
  • 1
    Try one of the working patches on this page. Look at the answer to this similar question. Use a test installation or backup before trying to patch Drupal core. (If it works well for you, you will probably need to patch the core at every core update, unless this option is making it into Drupal 8.5.)
    – eye-wonder
    Commented Oct 5, 2017 at 7:56
  • Curently is not possible using core to transliterate uploaded filenames (referer to this and this core issues). To solve this you need to use the Transliterate filenames for uploads module. Check the comments from above.
    – d70rr3s
    Commented Jan 13, 2020 at 10:07
  • You can use the File rename module Good luck Commented Mar 21 at 21:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.