I am working on a website that has some files/folders that are "stored" on the webserver and viewed by the site user. I need to use some PHP FTP commands to manipulate the folders from an internal control panel.
The FTP is fully accessible and useable via 3rd party FTP software and/or Windows Network Neighborhood as well. We can add, edit, rename, delete files and folders.
I can get the FTP commands to work, all except for a FTP_RENAME. This one fails constantly no matter what parameters I pass to it. I've even tried using getcwd() to see if that mattered, but it didn't. I've tried full paths, literal paths, etc... in FTP_RENAME. None work.
The FTP_RENAME commands I use are:
$dir = "/web/proofs/";
$old_dirfolderfile=$dir."oldfolder";
$new_dirfolderfile=$dir."newfolder";
$conn_id = ftp_connect($FTP_SERVER);
ftp_login($conn_id, $FTP_UID, $FTP_PWD))
$result=ftp_rename($conn_id, $old_dirfolderfile,$new_dirfolderfile);
ftp_close($conn_id);
for reference, the code that creates the folder or deletes the folder is:
$dir = "/web/proofs/";
$old_dirfolderfile=$dir."oldfolder";
$conn_id = ftp_connect($FTP_SERVER);
ftp_login($conn_id, $FTP_UID, $FTP_PWD);
$result=ftp_mkdir($conn_id, $old_dirfolderfile);
-or-
$result=ftp_delall($conn_id, $old_dirfolderfile);
ftp_close($conn_id);
These commands work, just the FTP_RENAME fails.
I tried turning on additional error reporting with:
error_reporting(E_ALL);
ini_set('display_errors',1);
I checked the PHPINFO() and those are now enabled... but... that doesn't show anything at all so I am definately frustrated.
Not sure where to go with this now.
Any suggestions?