File upload process can seem confusing to users

Created on 17 August 2025, 27 days ago

Problem/Motivation

First of all, thanks for this very helpful module.

I'm using it in one of my projects, and I've noticed that when a user is uploading files, if they don't click 'save' the files will remain in the file_managed table, as temporary, and depending on how your filesystem is configured may be removed during clean up activities.

Although 'save' does feel logical, this can lead to confusion because if a user doesn't save, the files will still be visible on page load (temporarily)

Steps to reproduce

1. Upload files via a directory listing node
2. Don't click save

Proposed resolution

I toyed with the idea of making these files permanent, but given the way save removes the entries from file_managed im a bit wary of doing this. Possibly a message advising a user they must click save to ensure the files remain permanent would suffice?

Remaining tasks

Decide on what we want to do, and do it.

User interface changes

Possible message to the user advising files are temporary unless saved.

📌 Task
Status

Active

Version

3.1

Component

Directory Listing Pages

Created by

🇬🇧United Kingdom aaron.ferris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @aaron.ferris
  • 🇳🇱Netherlands clivesj

    Maybe I don't fully understand this, but what you are describing is the normal behavior of the Drupal File upload.

    When you say:
    Steps to reproduce
    1. Upload files via a directory listing node
    2. Don't click save

    In step-1 you are not uploading the file yet, but just *selecting* the files you want to upload.
    Normally another step is needed to execute the upload. That can be by submitting a node or in case of Filebrowser, Saving the upload (Submitting the upload form)

    Starting with D8 we started using the Core Managed File Class to upload files in Filebrowser. That was for convenience. But other than that we don't do anything with the managed file system and corresponding Core DB tables.

    FB is always intended to use the Unmanaged Filesystem. So, Drupal does not (need to) know what is happening within Filebrowser. The reason is that from the start the intention was to by-pass the Managed File System. You can upload files (outside Drupal, FTP etc) , assign a directory listing to that Directory and Filebrowser will construct the directory.

    I hope this clarifies things, let me know if not or if you still require a feature.

  • Hi,

    Agreed with OP that this is confusing and actually created an issue with a client that took me a great deal of time to debug.

    Here's the issue from the client: Files uploaded in Directory Listing content type pages gets removed the following day. This happens for some pages, but not others. Client would re-upload the files, click on the save button to get the files back into those pages. However, the same files would get deleted the following day.

    After much debugging, I figured out that maybe when client first uploaded the files, they forgot to click on the save button. The files would still get uploaded and displayed on the page. However, these files are recorded in the file_managed table as temporary. Because they set temporary files to be deleted every 12 hours, these files would get deleted every day despite them re-uploading them.

    Since Filebrowser is completely different from Drupal's core file management system, I think this link needs to severed. This way, files aren't recorded in the file_managed table as temporary whenever the user forgets to click on the save button during file uploads. You mention that starting with D8, you guys used Drupal's Core Managed File Class for uploads. And that's probably why un-saved files are recorded as temporary in the file_managed table and don't get removed.

  • 🇳🇱Netherlands clivesj

    OK. I see it now and re-produced the behavior.
    We need some time to figure this out because I think the solution is to move away from the core upload class or make significant changes to it to prevent this unwanted side-effect.

  • 🇳🇱Netherlands clivesj

    I see, where the problem is.
    Filebrowser cleans up the file_managed table upon form submission. But if user does not submit the form the clean-up will not happen.

  • Sounds good, thanks for the quick response!

Production build 0.71.5 2024