Advertisement
Guest User

Untitled

a guest
Jun 7th, 2012
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1.   // Here My assumption is that $form_state['values']['script_file_upload'] returns the fid
  2.  $file_object = file_load($form_state['values']['script_file_upload']);
  3.  $destination = 'public://abc/' ;
  4.  if(file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) {
  5.    $file = file_move($file_object, $destination . $file_object->filename, FILE_EXISTS_REPLACE);
  6.  }
  7.  if ($file) {
  8.      $file->status = FILE_STATUS_PERMANENT;
  9.      drupal_chmod($file->uri, 0775);
  10.      $file = file_save($file);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement