How to set the file status of files uploaded through theme settings to permanent? I have been trying for a week to get image files uploaded to a Drupal server through the use of "managed_file" theme settings to remain on the site longer than the default 6 hours. I have visited the Stack Overflow/Exchange forums before
(https://stackoverflow.com/questions/8793518/set-file-status-permanent-for-appearance-settings-file-upload)
(Uploaded images in theme settings is going to be lost)
and have done my best to implement the provided solutions, but the uploaded files always disappear after 6 hours.

Here is one of the managed_file fields which I wish to make permanent:

$form['mentor_settings']['global_settings']['header_settings']['header_background_image'] = array(
      '#type' =&gt; 'managed_file',
      '#title' =&gt; t('Header Background Image'),
      '#default_value' =&gt; theme_get_setting('header_background_image'),
      '#description' =&gt; t('This image will match the full dimensions of the header in the back.'),
      '#upload_location' =&gt; 'public://themesettingspictures',
      '#upload_validators' =&gt; array(
        'file_validate_extensions' =&gt; array("png jpg jpeg gif"),
             ),
  );


The file is properly moved to the specified folder. I have attempted to set the file status to permanent using the code provided in the above links, but it has never worked.

I would like to know if anyone can show me what function will set the file status for me AND can show me how to write it for the setting above, with its very long array "path". The examples I have tried to imitate have always been for 1st level theme settings, but my theme has three different levels of settings, so I'm never sure if I'm referencing my individual settings properly when trying to change file status.

One more note: I have been a self-taught front end Wordpress and Drupal web designer for a year now, but my knowledge of PHP is weak and so I am usually unable to code and back-end functions on my own. If you simply tell me to "use" a certain PHP function, I will have no idea how to apply it within the context of Drupal. If you respond to my post with references to PHP functions, please explain if they must be in a certain file (theme-setting.php vs template.php) and provide any other Drupal contextual information.
You need set status FILE_STATUS_PERMANENT file when form submit

function mymodule_custom_form_submit($form, &amp;$form_state) {
  if (isset($form_state['values']['images'])) {
    $file = file_load($form_state['values']['images']);

    $file-&gt;status = FILE_STATUS_PERMANENT;

    file_save($file);
  }
}