This is a difficult one to explain. so, I am hoping that someone else has had a similar problem. I am uploading a file via custom configuration form, my field on the form looks like:
$form['homepage_image'] = array( '#type' => 'managed_file', '#description' => t('The image used on the home, agents, and featured property pages.'), '#default_value' => $config->get('pm_admin.homepage_image'), '#upload_location' => 'public://upload/siteimages', '#required' => TRUE, );
My submit handler sets the config property in the bog standard way:
Initially this all works fine, the image is saved and I can grab it and render it where I want in templates. However, after several hours (I have not figured out the trigger) the image disappears. The configuration form no longer has the value. The file is also removed from the file system.
Not sure what is causing this and would appreciate any help.