Cms: Possibility to disable "Upload a file" button

Created on 5 Oct 2020  Âˇ  14Comments  Âˇ  Source: craftcms/cms

Description

When we prepare our customers to work with the CMS, we give them the advice to group the Assets. Especially when multiple users are entering content.
The new feature to upload a file is very efficient, but it doesn't give you the opportunity to put the file in a certain sub folder. This may be confusing for our customers and it can create a big bulk of same files in a global folder.
That is why I want to ask if it is possible to give us the option to disable this button for the content managers whenever we feel there is a need to?
Thank you.

Robin Braibant
Statik

authoring enhancement

Most helpful comment

If we added this setting, it would disable drag-n-drop uploading as well, agreed?

All 14 comments

The new Upload button is nice, but I agree that it isn't always necessary/wanted. Would be great if it was possible to turn it off on a per-field basis (i.e. a new setting for Asset fields).

This button was added partly in response to https://github.com/craftcms/cms/issues/2778 which better surfaced the ability directly upload files by dragging and dropping into an assets field (which isn't something we train our clients on). However I'm in agreement that better exposing this functionality is potentially going to lead to users more often than not skipping the "Add an asset" button and using "Upload a file".

Whether or not this is desirable I think depends on how you are choosing to manage Assets. If you're setting a specific upload location folder based on the current element e.g. volume/{entry.title} then I can see how this is perfectly reasonable. But if you are taking a more curated approach and instead organising Assets by subject e.g. an images volume which subfolders such as "People", "Landscapes" then providing providing a one click "stick it anywhere" option is more problematic.

There are a number of reasons the second option is preferable, primarily it makes finding and reusing images in a curated image library easier. At the end of the day users are still going to organise assets badly and revert to dumping them into the default location but at least before they were forced to use the Assets browser so there was at least a chance they _might_ organise them sensibly.

Ideally the upload button and drag n drop onto a field were an option.

If we added this setting, it would disable drag-n-drop uploading as well, agreed?

I have to agree, I need a way to turn this "Upload Files" button off. It's making many of my asset fields confusing. At face value it looks like two buttons that do the same thing, but just named differently. It's also especially troublesome when using the Embedded Assets plugin also.

An example:

The top choice is to add a Vimeo video using Embedded Assets. But I also have an "Upload a File" button now that hints that the user can upload a video, when that is not the case at all.

The bottom choice just looks like two buttons that do the same thing. When my clients start seeing this, it's going to be pretty confusing to them. I expect I am going to have to answer a few emails from them. Would very much like the option to make this new "Upload a File" button optional.

Screen Shot 2020-10-05 at 2 41 11 PM

I feel like this adds confusion too and would like to remove it. Clients are just going upload their images multiple times instead of checking first. 99% of them aren't even aware they can draft images into the browser so I don't mind that functionality going away.

@brandonkelly Why would drag and drop need to be disabled if the extra button is disabled?
Could the "Add an image" button also be a drop target to upload to the predefined asset source?

Or, if these buttons are staying, how about they were labelled something like "Select an _image_" and "Add a new _image_" ?

Personally I thought the workflow of clicking to add an asset which opens the Assets modal where the asset can be selected or a new asset uploaded was great. This feels like it's solving a problem that isn't there (at least one I've never encountered).

Why would drag and drop need to be disabled if the extra button is disabled?
Could the "Add an image" button also be a drop target to upload to the predefined asset source?

Because the button is just an alternative UI for drag-n-drop uploading to Assets fields, and the complaint here is that the whole idea of uploading directly to the field can be undesired, in cases where you want the author to choose exactly where the file should be uploaded, rather than leaving it up to the Default Upload Location setting.

Are you saying you want the client to retain the ability to drag-n-drop files, but you don’t want them to be able to visually see that they can do that? What’s the point then?

Or, if these buttons are staying, how about they were labelled something like "Select an _image_" and "Add a new _image_" ?

See https://github.com/craftcms/cms/issues/6939#issuecomment-702966416.

Personally I thought the workflow of clicking to add an asset which opens the Assets modal where the asset can be selected or a new asset uploaded was great.

To be clear, this _only_ concerns the initial field UI, not the modal window. Nothing in there will change.

This feels like it's solving a problem that isn't there (at least one I've never encountered).

See https://github.com/craftcms/cms/issues/2778#issuecomment-696709124 for context.

Just added a new setting to Assets fields for the next release, which resolves this.

The new Assets field setting, a checkbox which is labelled, “Allow uploading directly to the field”.

Great compromise! Thanks @brandonkelly !

Great resolution

I was here to just say ☝️me too! But this solution means it's all an improvement on the previous version. Win!

Craft 3.5.13 is out now with that new setting ✨

@brandonkelly thank you for making this an optional field... I have never checked for a CraftCMS update as eagerly.

I am noticing that the default option is ON.

To recap,

  • A new "Upload an Image" button was introduced system-wide in a CMS update. The button was automatically added next to every single image asset selection field.
  • After some of the community indicating that this new feature might disrupt existing flows and require additional training, the feature was made optional in the following release (thank you for acting so quickly on this!)
  • The default setting of this now optional feature is ON, which means anyone who doesn't want it added to their CP needs to disable it, for every single image asset field.

I personally will need to spend over an hour changing 20+ fields in order to maintain the status quo of the CraftCMS I am supporting.

I am wondering, is there a way to change this via a SQL query globally?

  • A new "Upload an Image" button was introduced system-wide in a CMS update. The button was automatically added next to every single image asset selection field.

@andreimoment Yes the button was added, but the ability to upload files directly to an Assets field is nothing new. It has always been possible via drag-n-drop. The button simply adds a more intuitive UI for it.

  • The default setting of this now optional feature is ON, which means anyone who doesn't want it added to their CP needs to disable it, for every single image asset field.

There was a consensus that this new setting should affect both the button and the ability to upload via drag-n-drop _(see https://github.com/craftcms/cms/issues/6954#issuecomment-703635099 which at present has 10 👍s and zero 👎s)_. So having the setting be disabled by default would cause a regression of a firmly established feature.

I am wondering, is there a way to change this via a SQL query globally?

I’d suggest making the change via your project config, which would be safer.

  1. Go to Utilities → Project Config and click the “Rebuild” button (or run php craft project-config/rebuild). That will cause all of your Assets fields’ project config YAML files to be updated with the new allowUploads setting.

  2. Open your config/project/fields/ folder in a text editor, and find/replace all allowUploads: true instances with allowUploads: false.

  3. Open config/project/project.yaml in a text editor and tweak the dateModified value and save it.

  4. Reload the Utilities → Project Config page, and click the “Apply changes only” button (or run php craft project-config/apply).

@brandonkelly thank you for the detailed and thoughtful response.

It is very useful to see how powerful the YAML configuration files are and that it is possible to make setting changes via direct edits.

I ended up completing the updates via the CP, but will definitely consider the direct route if faced with repetitive changes in the future.

Also appreciate your pointing out the discussion behind the decision to add the button as a default.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

richhayler picture richhayler  Âˇ  3Comments

davist11 picture davist11  Âˇ  3Comments

leigeber picture leigeber  Âˇ  3Comments

rynpsc picture rynpsc  Âˇ  3Comments

bitboxfw picture bitboxfw  Âˇ  3Comments