You are here

function webfm_upload_new in Web File Manager 5

1 call to webfm_upload_new()
webfm_version_upload in ./webfm.module
Version uploaded file that overwrites existing file NOTE: uploaded file is already stored in $_SESSION['temp_upload'] via iframe. Feedback in ajax since drupal_set_message points back into main page (not refreshed).

File

./webfm.module, line 1765

Code

function webfm_upload_new(&$msg) {

  // Insert new file into database with munged name & auto-incremented fid
  if (file_move($_SESSION['temp_upload'], $_SESSION['temp_upload']->dest)) {

    // file was moved to its final destination

    //Insert file into database if under webfm_root
    if (($ret = webfm_dbinsert_file($_SESSION['temp_upload'], $msg)) !== FALSE) {

      // file was inserted into the database
      $msg = t('Upload success');
      return $ret;
    }
    else {
      file_delete($_SESSION['temp_upload']->filepath);
      return FALSE;
    }
  }
  else {
    $msg = t('file_move to ') . $_SESSION['temp_upload']->dest . t(' failed');
    return FALSE;
  }
}