alasdairdf
03-09-2006, 12:38 PM
I'm trying to automate the copying of files using PHP FTP functions (the copy function won't work because of permission problems) from the public_html to a subdomain.
The problem is that some of the files aren't being copied, and I've tried everything but can't figure out why!
Here's the code:
ftp_mkdir($conn_id, "$subdomain/purchase"); //this works
ftp_mkdir($conn_id, "$subdomain/contact"); //this works
ftp_put($conn_id, "$subdomain/index.php", 'index.php', FTP_TEXT); //this works
ftp_put($conn_id, "$subdomain/purchase/index.php", 'purchase/index.php', FTP_TEXT); //doesn't work
ftp_put($conn_id, "$subdomain/contact/index.php", 'contact/index.php', FTP_TEXT); //doesn't work
The errors I get are:
Warning: ftp_put(purchase/index.php) [function.ftp-put]: failed to open stream: No such file or directory in /home/affiliat/public_html/purchase/file.php on line 78
Warning: ftp_put(contact/index.php) [function.ftp-put]: failed to open stream: No such file or directory in /home/affiliat/public_html/purchase/file.php on line 79
The main index.php file copies fine, but the ones in the subdirectories don't.
Does anyone know why this is not working, and how I could make it work?
The problem is that some of the files aren't being copied, and I've tried everything but can't figure out why!
Here's the code:
ftp_mkdir($conn_id, "$subdomain/purchase"); //this works
ftp_mkdir($conn_id, "$subdomain/contact"); //this works
ftp_put($conn_id, "$subdomain/index.php", 'index.php', FTP_TEXT); //this works
ftp_put($conn_id, "$subdomain/purchase/index.php", 'purchase/index.php', FTP_TEXT); //doesn't work
ftp_put($conn_id, "$subdomain/contact/index.php", 'contact/index.php', FTP_TEXT); //doesn't work
The errors I get are:
Warning: ftp_put(purchase/index.php) [function.ftp-put]: failed to open stream: No such file or directory in /home/affiliat/public_html/purchase/file.php on line 78
Warning: ftp_put(contact/index.php) [function.ftp-put]: failed to open stream: No such file or directory in /home/affiliat/public_html/purchase/file.php on line 79
The main index.php file copies fine, but the ones in the subdirectories don't.
Does anyone know why this is not working, and how I could make it work?