A file is a media type that has properties, including the name. As far as I know the name will get modified to make it more human friendly (which makes sense) but the actual filename itself doesn't change. So you should be able to access the URL property to get the original filename, if needed.
Unfortunatley the file itself is beeing renamed the way I described above. So a user that uploads a file and later downloads it will get differently named files. I guess this is somewhere done in the Angular JS code, but I am still searching the code part where it is done...
Ahh, never realised it renamed the file name, too. I that case, check the PR that added this renaming - it has some useful info and a Gist from Seb to revert the renaming.
Yes, I found that issue some days ago, but this also is not the problem. The issue describes how to disable the friendly name functionality for the name property of the file. I also replied to that issue.
But this still does not solve the problem that the uploaded file itself is renamed. I have not found any evidence in the Angular JS code which is responsible for it.
So it must happen in the C# Code. Since the file is already renamed in the MediaService.Saving event, it must happen somewhere before...
This will keep your uploaded file name when saving the file to the file system.
Of course one must know that it is absolutely sensible to rename a file to a web-safe filename when uploading. But there might be some cases where this behavour is not wanted.
This is in the Core from Umbraco and is not what we want to change there. Is there an option to disable this functionality or to create our own functionality for this name changing event.
Keep original filename in filesystem for uploaded file
Hello,
I noticed that the names of files that are uploaded to the file system in the media folder are automatically changed by Umbraco.
E.g. when I place a file with original name "Text 1.2.3.txt" in the umbracoFile property, it is uploaded to /media/
I don't know since when this behaviour is implemented, but it is not suitable for my needs.
I tried to add some logic to the MediaService.Saving event, but this seems to be the wrong place, because the file has already been changed then.
Can anybody help here?
Kind regards, Stephan
A file is a media type that has properties, including the name. As far as I know the name will get modified to make it more human friendly (which makes sense) but the actual filename itself doesn't change. So you should be able to access the URL property to get the original filename, if needed.
Hi Dan,
Unfortunatley the file itself is beeing renamed the way I described above. So a user that uploads a file and later downloads it will get differently named files. I guess this is somewhere done in the Angular JS code, but I am still searching the code part where it is done...
Stephan
Ahh, never realised it renamed the file name, too. I that case, check the PR that added this renaming - it has some useful info and a Gist from Seb to revert the renaming.
https://github.com/umbraco/Umbraco-CMS/issues/2943
Hi Dan,
Yes, I found that issue some days ago, but this also is not the problem. The issue describes how to disable the friendly name functionality for the name property of the file. I also replied to that issue.
But this still does not solve the problem that the uploaded file itself is renamed. I have not found any evidence in the Angular JS code which is responsible for it.
So it must happen in the C# Code. Since the file is already renamed in the MediaService.Saving event, it must happen somewhere before...
Stephan
I have not found a solution yet. Can anybody help?
Hello,
Found out, that you have to change the Umbraco distribution and compile an own version of it.
Change line 796 to
This will set the Media name o exactly the file name when creating a Media item via the direct upload or drag & drop.
Comment line 149
This will keep your uploaded file name when saving the file to the file system.
Of course one must know that it is absolutely sensible to rename a file to a web-safe filename when uploading. But there might be some cases where this behavour is not wanted.
Kind regards, Stephan
This is in the Core from Umbraco and is not what we want to change there. Is there an option to disable this functionality or to create our own functionality for this name changing event.
Anybody with an sollution for this?
is working on a reply...