We build an admin page using variable_admin_subforms. On this page we can set files using file_managed variable.

When setting a file on our custom build admin page, the file gets saved perfectly. When I change the file on our custom page, no problems.

But when I go to the default variable admin page ( admin/config/system/variable/edit/[my_file_variable] ) and just save the form, the file gets deleted.

This is caused by the submit callback of file_managed form, which wants to delete the old file, but doesn't check is the file has changed or not.

Patch in att. checks if the new file is different from the old file before deleting.

CommentFileSizeAuthor
variable_extra_file_gets_deleted.patch1.47 KBnapche