fixes U4-10816 Umbraco V7.7.1 - Media - File upload taking full path

This commit is contained in:
Claus
2018-04-05 10:41:08 +02:00
parent ebbd05dc97
commit 8ddda5868e

View File

@@ -466,6 +466,17 @@ namespace Umbraco.Web.Editors
[ModelBinder(typeof(MediaItemBinder))]
MediaItemSave contentItem)
{
//Recent versions of IE/Edge may send in the full clientside file path instead of just the file name.
//To ensure similar behavior across all browsers no matter what they do - we strip the FileName property of all
//uploaded files to being *only* the actual file name (as it should be).
if (contentItem.UploadedFiles != null && contentItem.UploadedFiles.Any())
{
foreach (var file in contentItem.UploadedFiles)
{
file.FileName = Path.GetFileName(file.FileName);
}
}
//If we've reached here it means:
// * Our model has been bound
// * and validated