I cannot move files
| From: | Giacomo Cantilli | Date: | Thu, 21 Oct 2004 20:43:56 +0000 |
| Subject: | I cannot move files | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-200030@lists.php.net to get a copy of this message | ||
Hi,
I am building a mailing list. My OS is MandrakeLinux 10.0.
I need to move an uploaded file. That's the script:
---------------------
function show_info($file)
{
$utfn = $file['userfile']['tmp_name'];
$ufn = $file['userfile']['name'];
$dest = "/home/yaki/y_uplds/" . $ufn;
if (is_uploaded_file($utfn))
echo "<p>File uploaded successfully.</p>";
else
echo "<p>Failure in uploading</p>";
if (move_uploaded_file($utfn,$dest)) // line 66
{
print "File moved successfully.\n";
print_r($file);
}
else
{
print "Failure in moving file.\n";
print_r($file);
}
}
--------------------
safe_mode is Off in php.ini, safe_mode_gid is Off as well.
Source and destination directory have identical owner.
Those are the responses of the script:
File uploaded successfully.
Warning: move_uploaded_file(/home/yaki/y_uplds/page01.html): failed to
open stream: Permission denied in /var/www/html/php05.php on line 66
Warning: move_uploaded_file(): Unable to move '/tmp/phpoJDoSs' to
'/home/yaki/y_uplds/page01.html' in /var/www/html/php05.php on line 66
Failure in moving file. Array ( [userfile] => Array ( [name] =>
page01.html [type] => text/html [tmp_name] => /tmp/phpoJDoSs [error] =>
0 [size] => 721 ) )
I suppose PHP is running as Apache module and the PHP manual tells me
that I should get appropriate permissions. At this point, after making
several attempts, I don't know how to obtain them.
Thank you in advance for your help
Giacomo Cantilli
cantilli@gem.it