Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293694

Managed-file uploads do not support multiple actions per submit, and can't be replaced without multiple submits.

$
0
0

Problem/Motivation

I'm using the upload feature in an edit form.
I can successfully upload or delete an image file, but a replacement,
removing an existing file followed by an Upload with the same submit
results in the persistence of the "removed" file plus the new file
with a status code of zero (0).
Displaying the replaced file after a short time causes a wsod,
since CRON removes temporary files.

Steps to reproduce

This can be reproduced by downloading the hello and common
modules here.
Applicable code is also posted in the files section.
Screen shotsin the files illustrate the issue. They are prefixed with the same step Ids (1a - 5a)
as their explanations below:

1a. Controller image with original file (Louvre 124).
1b. Original file_managed view.
2a Edit image before Removal.
2b. file_managed view before removal (same as 1b).
3a. Edit image after Removal but before Addition.
3b. file_managed view after removal but before addition (same as 1b).
3c. File directory view before submit. Only the original file (Louvre 124) is shown.
4a. Edit image after addition of new file (Louvre 132) but before the Submit action.
4b. File directory view after submit. Both files are stored.
4c. file_managed view after submit. showing new file with status=0 and the original file (louvre124).
5a. Controller image after the Submit of the Edit image showing only the new file (Louvre132).

Proposed resolution

I'm not familiar with the Drupal image system and can't be sure of the cause or offer a resolution.
Therefore I'm initially submitting it as a support request. If anyone finds a correction or a workaround, I'll use that. If the managed file works as designed, I'll change the status to a new feature request. If it's an error, I'll change the status to a bug report. Any comments are appreciated.

Remaining tasks

I'm not familiar with the Drupal image system

User interface changes

I added a workaround to change the status to permanent in the Controller module
of another module (asset), but the old, replaced file remains.
I also added a warning message.

API changes

Not applicable.

Data model changes

Not applicable.

Release notes snippet

None.


Viewing all articles
Browse latest Browse all 293694

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>