0

I am not able to transfer file from one server to another using ftp_put() below is the warning its showing and also files are not getting transfered.
If i put absolute path below error is coming
>Warning: ftp_fput() [function.ftp-fput]: Can't open that file: No such file or directory in ...

5
Contributors
8
Replies
37
Views
4 Years
Discussion Span
Last Post by pzuurveen
0

It may be a wrong path to the local file, make sure you use absolute paths:

$file = $_SERVER['DOCUMENT_ROOT'] . '/path/to/file.ext';
0

Are you using ftp_put or ftp_fput, you mention the first, but the warning shows the second. Their functionality is different.

0

does the file you are moving exist an have you opened it?
show us some code
or do we have to keep gessing?

0
$file = 'test2.php';
$fp = fopen($file, 'r');

// set up basic connection
$conn_id = ftp_connect('test.com');
$dest  = "/home/xxxxx/public_html/";
// login with username and password
$login_result = ftp_login($conn_id, 'xxxx', 'xxxx');

// try to upload $file

    echo "Successfully uploaded $file\n";
} else {
    echo "There was a problem while uploading $file\n";
}

// close the connection and the file handler
ftp_close($conn_id);
fclose($fp);
0

Your code misses the ftp_fput statment (copy&past error?)
the example code from php.net that you apartly use
works for me
are you using $dest as $file?

$remote_file=$dest.$file;
// try to upload $file
if (ftp_fput($conn_id, $remote_file, $fp, FTP_ASCII)) {
    echo "Successfully uploaded $file\n";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.