Upload file and fill in fields in one step; or trigger a rule when a file is uploaded

Drupal Answers Asked by deinqwertz on March 2, 2021

I want to make use of the Media module and the File entity module to upload files, in particular images, to my site without having to attach them to a node. Solely uploading images works like a charm, as the Media module automatically places an “add file” link within the navigation menu.

I also added a couple of fields to my image file type. Unfortunately, the Media module doesn’t allow me to choose the image file and fill in the fields at the same time, and then submit. Instead, I have to upload the file, go back to the file, click on edit and fill in the fields afterwards, which in my opinion is pretty annoying.

I am not sure if this issue can be resolved somehow. If it can not be, this could be a workaround:

When I upload a file, a rule is triggered that sends me to the edit page. This way uploading the image and filling in the fields somewhat forms a unit.

However, the Rules module does not offer to react on file uploads.

Does anyone have an idea how to get around this issue?

2 Answers

You could also try the File Entity Inline module, which allows you to inline edit the files after they are uploaded.

Here is a quote about it (from the module's project page):

... aims to provide the ability to edit File entities inline, as part of another form (such as nodes). This should enable the ability for reusable and site-wide editing of file properties, such as description, alt text, captions, bylines, etc.

Configuration is on a per-field basis. So to configure this module, you must visit the "Manage Fields" tab for your content type (or taxonomy terms, comments, etc.) By default, all fields on all file types are displayed. If you want to make things like "description" and "alt text" global instead of per-usage, you should disable the built-in description and alt text fields and use those provided by a file type instead.

Answered by gmclelland on March 2, 2021

So I believe that uploading and editing files works correctly with the latest dev release of the media module when using a file field or image field.

Like you said when you go to file/add it is using the file_entity module which I believe they are discussing adding upload and editing here

Answered by gmclelland on March 2, 2021

Add your own answers!

Related Questions

KernelEvents::REQUEST is not fired on cached pages

2  Asked on December 8, 2021 by user34185


Add column to custom field schema

3  Asked on December 8, 2021 by coder1


Order receipt email content

1  Asked on December 8, 2021 by pete-l


Date time save in database

0  Asked on December 8, 2021 by pratip-ghosh


How can I create a recommended project in the root directory?

2  Asked on December 6, 2021 by user2574948


Wrapping fields together in a Views Exposed Filter

1  Asked on December 4, 2021 by typologist


Submit form and disable submission button

7  Asked on December 4, 2021 by matt9292


How to check if an entity is referenced before deleting?

2  Asked on December 2, 2021 by halofx


Add class to {{ link }} twig attribute

3  Asked on December 2, 2021


Remove field attributes using hook_form_alter()

1  Asked on November 30, 2021 by senthilkumar


How to send email to submitter in a webform?

2  Asked on November 30, 2021 by cel57


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP