U4-7729 - 7.4.0-Beta Cannot drag and Drop PDF on Media Section

Created by Adrian Ursu 14 Jan 2016, 09:06:22 Updated by Harvey Williams 15 Dec 2016, 16:12:42

When I try to drag and drop a PDF file (or any other file type that's not an Image), I gaet a message saying that only a these.... file types are allowed. The list of file types is limited to images

I was expected to allow me to upload the files with drag and drop

Instead, an error message was shown

Comments

Sebastiaan Janssen 14 Jan 2016, 09:09:09

You can change allowed filetypes in umbracoSettings.config: https://our.umbraco.org/Documentation/Reference/Config/umbracoSettings/


Sebastiaan Janssen 14 Jan 2016, 09:12:38

In fact, nope, that's only for images, never mind.


Harvey Williams 22 Jan 2016, 16:46:37

@sebastiaan I think you are partially right here. Adding in the <imaging> below the <content> with <imageFileTypes> that has the pdf value inside of it at least allows the JS to post the file to the C# that handles it.

https://github.com/umbraco/Umbraco-CMS/blob/release-7.4.0-beta2/src/Umbraco.Web.UI.Client/src/views/common/overlays/mediaPicker/mediapicker.controller.js#L19

The above link shows how the accepted files types are taken from the <imageFileTypes> config item.

Adding PDF changes the message from (Only allowed file types are: ".jpeg,.jpg,.gif,.bmp,.png,.tiff,.tif") to (An error has occurred.).

I think the problem may be in this file:

https://github.com/umbraco/Umbraco-CMS/blob/d50e49ad37fd5ca7bad2fd6e8fc994f3408ae70c/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs#L9

Though the code looks fine to me on first inspection.


Christoph 11 Feb 2016, 12:44:39

@sebastiaan Will this issue be solved in the finished 7.4.0 Version?? The Drag-and-Drop PDF Upload is an essential feature with a high priority!!! I´m using the RC - the issue is still there... Or do you have a solution already?


Harvey Williams 11 Feb 2016, 13:25:44

@c.claus@gmx.de You can still upload the files individually.


Per Ploug 11 Feb 2016, 13:45:37

PR for review: https://github.com/umbraco/Umbraco-CMS/pull/1114

Tested dragging images, pdfs and a cshtml file to the dropzone, cshtml is rejected, uses the disallowed files as a blacklist instead of imagefiles as a whitelist


Christoph 11 Feb 2016, 14:52:16

@sebastiaan @pploug Thanks for the solution and the fixing. How can I fix it in my current RC-Installation? Which files do I have to update?


Sebastiaan Janssen 11 Feb 2016, 15:38:26

We're releasing 7.4 final soon, so keep an eye on https://twitter.com/umbracoproject and then you can just do a normal upgrade.


Rody van Sambeek 17 Feb 2016, 09:32:09

@pploug Look at this pull request: https://github.com/umbraco/Umbraco-CMS/pull/1133 I have added your fix also to the drag-drop uploader, because that is still "broken" in the 7.4.0 release.


Chris Dixon 23 Apr 2016, 14:12:48

Still a bug in media picker in 7.4.2, but code has changed in dev v7, so here's a fix if you need it until then In Umbraco\js\umbraco.controllers.js REPLACE $scope.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.imageFileTypes); WITH $scope.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.disallowedUploadFiles).replace(/./g, "!.");


Harvey Williams 06 Dec 2016, 13:53:57

Looks like the bug may still be there, however, as Chris says, the code has changed: https://github.com/umbraco/Umbraco-CMS/blob/f2c406f168a65200568328fd8b69970db84e4012/src/Umbraco.Web.UI.Client/src/views/common/overlays/mediaPicker/mediapicker.controller.js#L19


Harvey Williams 15 Dec 2016, 16:12:42

Appears to be fixed in 7.5.4 (if not before).


Priority: Major

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category: Editor

Backwards Compatible: True

Fix Submitted: Inline code

Affected versions: 7.4.0

Due in version: 7.4.0

Sprint:

Story Points:

Cycle: