Using Drupal 8, I want to rename and clean all filenames, e.g. If someone uploads file named like this Screen Shot 2016-03-29 at 1.13.21 PM.jpg, I want to clean it so that convert all spaces to dashes - and make everything lowercase, So I should get screen-shot-2016-03-29-at-1.13.21-pm.jpg.

I want to do this on image upload dialog form of CKEditor.

  • 1
    Try drupal.org/project/filefield_paths – user21641 Mar 29 '16 at 9:50
  • filefield_paths works only for fields attached to content types. I want similar solution for inline images. – otarza Mar 29 '16 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 Oct 5 '17 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.

  • It does provide an answer, currently to transliterate file uploads you need to install the referred module. The reference to the module is extracted from the referred answer in the comments and the linked core issue. – d70rr3s Jan 13 '20 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.