ftp_put() problem
| From: | Anders Hansén | Date: | Tue, 27 Jun 2000 07:59:55 +0000 |
| Subject: | ftp_put() problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3292@lists.php.net to get a copy of this message | ||
Good Morning ;)
I am trying to use the ftp_put() command in order to upload a file to a
remote server. But when I do I get a error message stating:
Warning: ftp_put: metroflow.txt: Access is denied. in
/home/anders/public_html/ftp_manager/index.php on line 18
I've issued chmod 777 for the file as well as the entire directory. PHP is
configured with FTP and safe_mode is off. The FTP-connection seems to be
working fine, as I am able to list the contents on the remote server with
PHP. And when using a ordinary FTP client I am able to upload the file to
the server.
Using PHP Version 4.0RC1 on Red Hat Linux release 6.1
Does anyone recognize this problem? Any ideas would be helpful.
yours,
Anders Hansén
web developer @ Infomaker, Sweden
Source code for the script:
<?
$server = "nnn.nnn.nnn.nnn";
$path = "path";
$ftp = ftp_connect( $server ) OR DIE("could not connect<br>");
if(ftp_login( $ftp, "anonymous", "an@an.an"))
echo "<H1>$server</H1>\n$path<p>\n";
else echo "login failed<br>";
# This is line 17
if(ftp_put($ftp, "metroflow.txt", "metroflow.txt", FTP_BINARY))
echo "Transfer successful!<br>";
else echo "Transfer unsuccessful...<br>";
$files = ftp_nlist($ftp,$path);
function printElement($element)
{
global $server,$path;
echo "<A HREF=\"ftp://$server$path$element\">$element</A><br>\n";
}
echo "<p>Files in $server$path:</p><p>";
array_walk($files, "printElement");
?>