Hi All
I have a requirement, where 1. Using drupal (7.14) form, uploads a excel file 2. Read a file name, say resume.doc from excel file 3. Then get the file resume.doc from local machine and put to a proper directory

I am able to do step 1 and 2 properly. For step 3, I am able to created the directory with 0775 permission.

To upload the file I am making use of drupal api drupal_move_uploaded_file. Please note that I can not make use of file_save_upload api, as here I do not have any form with file field.

Can somebody guide me why drupal_move_uploaded_file is not uploading the file.

I debugged further , my observations are as below.

function drupal_move_uploaded_file($filename, $uri) {
  $result = @move_uploaded_file($filename, $uri);
  // PHP's move_uploaded_file() does not properly support streams if safe_mode
  // or open_basedir are enabled so if the move failed, try finding a real path
  // and retry the move operation.
  if (!$result)
  {
    drupal_set_message('move_uploaded_file did not work');
    if ($realpath = drupal_realpath($uri))
    {
        drupal_set_message('calling move_uploaded_file with realpath ' . $realpath . ' and file ' . $filename);
        $result = move_uploaded_file($filename, $realpath);
    }
    else
    {
        drupal_set_message('calling move_uploaded_file with uri ' . $uri);
        $result = move_uploaded_file($filename, $uri);
    }
  }
  else
  {
    drupal_set_message('move_uploaded_file did work');
  }

  return $result;
}



@move_uploaded_file($filename, $uri);   did not work.
next it tried to upload with realpath , next line executed was
$result = move_uploaded_file($filename, $realpath);

That also did not work.

Can somebody pls point me whats the issue here...

Thanks in advance..

Austin