ftp_get issues

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

ftp_get issues

Post by daven »

I am attempting to use ftp_get to download a file from the server to the client machine (in this case a Windows box). Regardless of what I do, I receive the following error message when I use the function:

"Warning: ftp_get() [function.ftp-get]: Error opening $localfile in $script on line 7". ie--I cannot create the local file, nor can I open it if it already exists.

code snippet is as follows:

Code: Select all

<?php
$local="c:\\file.jpg"; // I have tried with absolute paths, relative paths, etc.
$remote="/path/to/file.jpg"; 

$ftp_conn=ftp_ssl_connect($host) or die('connection failed');
@ftp_login($ftp_conn,$username,$password);
ftp_get($ftp_conn,$local,$remote,FTP_BINARY);
?>
I can (and do) use ftp_put without error. From the error message, it seems like a permissions problem, but I have tried it on various clients with various settings and it never changes.
Post Reply