You are here

function _filebrowser_build_new_upload_file_name in Filebrowser 7.4

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.2 filebrowser.common.inc \_filebrowser_build_new_upload_file_name()
  4. 7.3 filebrowser.common.inc \_filebrowser_build_new_upload_file_name()

Parameters

array $form_state:

Object $node:

Return value

string

2 calls to _filebrowser_build_new_upload_file_name()
filebrowser_form_upload_submit in ./filebrowser.module
uploads submission. @inheritdoc
filebrowser_form_upload_validate in ./filebrowser.module
uploads validation.

File

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

Code

function _filebrowser_build_new_upload_file_name($node, $form_state) {
  $file_name = $_FILES['files']['name']["file"];
  if (!empty($form_state['values']["file_name"])) {
    $path_info_new = pathinfo($form_state['values']["file_name"]);
    $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;
}