You are here

function _filebrowser_build_new_upload_file_name in Filebrowser 7.2

Same name and namespace in other branches
  1. 8 filebrowser.common.inc \_filebrowser_build_new_upload_file_name()
  2. 6.2 filebrowser.form.upload.inc \_filebrowser_build_new_upload_file_name()
  3. 7.4 filebrowser.common.inc \_filebrowser_build_new_upload_file_name()
  4. 7.3 filebrowser.common.inc \_filebrowser_build_new_upload_file_name()

Parameters

form_state:

i:

path_info_new:

path_info_old:

2 calls to _filebrowser_build_new_upload_file_name()
filebrowser_form_upload_submit in ./filebrowser.module
uploads submition.
filebrowser_form_upload_validate in ./filebrowser.module
uploads validation.

File

./filebrowser.common.inc, line 641
Misc filebrowser common functions.

Code

function _filebrowser_build_new_upload_file_name($node, $form_state, $i) {
  $file_name = $_FILES['files']['name']["file_{$i}"];
  if (!empty($form_state['values']["file_name_{$i}"])) {
    $path_info_new = pathinfo($form_state['values']["file_name_{$i}"]);
    $path_info_old = pathinfo($file_name);
    $file_name = $path_info_new['filename'];
    if (isset($path_info_old['extension'])) {
      $file_name .= ".{$path_info_old['extension']}";
    }
  }
  _filebrowser_load_files($node);
  $target = _filebrowser_encoding_to_fs($node, $node->file_listing['.']['full-path'] . "/" . $file_name);
  return $target;
}