Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp file path 1

Status
Not open for further replies.

joeschoe

Programmer
Jan 13, 2002
67
IL
In PHP I am using ftp to copy files. I am having trouble with the ftp_put() command. I keep on getting "/public_html/papa/v227: No such file or directory".
Here is the code I use
Code:
$source_file = "/home/joeschmoe/public_html/vbbu/v226";
$filename=$source_file;
if (file_exists($filename)) {
    print "The file $filename exists";
} else {
    print "The file $filename does not exist<br>";
}
$destination_file = "/public_html/papa/v227";
$download = ftp_put($conn_id, "$destination_file", "$source_file", FTP_BINARY);
I have tried many variations of the destination file path.
The directory public_html/papa does exist with no access restrictions and the source file gives a positive "file exists".
I feel that there is something wrong with the way I specify the file path for ftp.
 
It appears most likely that you should use the full path from the file system root for the destination file.
You correctly use /home/joeschmo/public_html/vbbu/v226
So you should also use /home/whateveruser/public_html/ in the destination.

Are you copying on the same server?
 
The problem lay in the file permissions in the directories.
I had updated them but it took a while for the system to implement the changes.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top