Hi All<br>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<br>
<br>I am able to do step 1 and 2 properly. For step 3, I am able to created the directory with 0775 permission.<br><br>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.<br>
<br>Can somebody guide me why drupal_move_uploaded_file is not uploading the file.<br><br>I debugged further , my observations are as below.<br><br>function drupal_move_uploaded_file($filename, $uri) {<br> $result = @move_uploaded_file($filename, $uri);<br>
// PHP's move_uploaded_file() does not properly support streams if safe_mode<br> // or open_basedir are enabled so if the move failed, try finding a real path<br> // and retry the move operation.<br> if (!$result) <br>
{<br> drupal_set_message('move_uploaded_file did not work');<br> if ($realpath = drupal_realpath($uri)) <br> {<br> drupal_set_message('calling move_uploaded_file with realpath ' . $realpath . ' and file ' . $filename);<br>
$result = move_uploaded_file($filename, $realpath);<br> }<br> else <br> {<br> drupal_set_message('calling move_uploaded_file with uri ' . $uri);<br> $result = move_uploaded_file($filename, $uri);<br>
}<br> }<br> else<br> {<br> drupal_set_message('move_uploaded_file did work');<br> }<br><br> return $result;<br>}<br><br><br><br>@move_uploaded_file($filename, $uri); did not work.<br>next it tried to upload with realpath , next line executed was<br>
$result = move_uploaded_file($filename, $realpath);<br><br>That also did not work.<br><br>Can somebody pls point me whats the issue here...<br><br>Thanks in advance..<br><br>Austin<br>