Click to See Complete Forum and Search --> : PHP FTP Problem!


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?

Bozebo
03-09-2006, 01:13 PM
do the purchase/index.php and the other files exist???

Bozebo
03-09-2006, 01:14 PM
i think subdirectories cause problems, i had that problem with a file creating thing, could only create them in the same dir... i got round that by making it add to the dir + the file var... dunno what u need though :( soz

alasdairdf
03-09-2006, 01:22 PM
Yes, they do definetely exist!

alasdairdf
03-09-2006, 04:06 PM
Seriously, can anyone else help? I really need this working today. Thanks!

alasdairdf
03-09-2006, 06:44 PM
Well I've fixed it now.

tabzter
03-09-2006, 07:10 PM
how?