Change file to permant status

<?php
function modulename_siteconfig_validate($form , $form_state) {
  if(!empty($form_state['values']['image']) {
    $f = file_load($form_state['values']['image']);
    $f->status =1;
    $foutput = file_save($f);
    file_usage_add($foutput, 'modulename', 'modulename', $foutput->fid);  /*** ****/
  }
}
?>
Help Share this Article