U4-5572 - Improve Automatic Media item naming based on the uploaded file name when adding media with drag/drop

Created by Dan Booth 01 Oct 2014, 19:42:39 Updated by Claus Jensen 07 Nov 2016, 10:48:45

Tags: Up For Grabs PR

When dragging and dropping files for upload on the created media items are given the name of the file. It would be much nicer if a bit of simple sanitisation was applied to "normalise" the name eg. For the name you would:

  • Strip the file extension
  • Replace underscores with spaces
  • Initial capitalise the name

So if you uploaded a file called "my_amazing_kitten.jpg" it would be named "My Amazing Kitten". If you uploaded a file called "Some_AMAZING_dinosaurs-1.PDF" it would be named "Some Amazing Dinosaurs-1" etc.

Implementation Requirements

Make the media item name "nice" since file names could be pretty ugly, we have string extensions to do much of this but we'll need:

  • Pascalcase the name (use string extensions)
  • strip the file extension
  • underscores to spaces
  • probably remove 'ugly' characters - let's discuss

All of this logic should exist in a string extensions method and be unit tested

There's notes in the Core code here: 726bef1edf2ee36b8cdb560fa61548671a793f69


Dan Patching 29 Oct 2015, 14:18:42


Shannon Deminick 11 Feb 2016, 10:53:55

Hi all,

I've updated this issue with implementation requirements above, we'll schedule this for 7.4.1 and hoping this can be a community update. Please discuss any implementation details below, thanks!

Patrick Scott 19 Feb 2016, 12:20:38

I would also suggest replacing - with a blank space e.g. my-amazing-kitten.jpg to "My Amazing Kitten"

Shannon Deminick 18 Mar 2016, 09:29:31

Hi @danpatching@gmail.com Any chance you have time to review these requirements and re-submit a PR or are you too busy at the moment?

Shannon Deminick 11 Apr 2016, 12:21:19

Hi @danpatching@gmail.com are you able to have a look at the above?

Patrick Scott 03 Nov 2016, 14:36:01

Pull request https://github.com/umbraco/Umbraco-CMS/pull/1582

Dan Patching 03 Nov 2016, 14:42:23

sorry, not sure how I missed these messages. Think I worked on this during last years hackathon.

Patrick Scott 03 Nov 2016, 14:44:43

Ha, I am at this years hackathon!

Dan Patching 03 Nov 2016, 14:50:08

so I see! well done with the fix :D

Priority: Up for grabs

Type: Feature (request)

State: Open


Difficulty: Very Easy

Category: UI

Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.5.4

Due in version:


Story Points: