PHP-Code:
<?php
$destination_file = "test3.txt";
$source_file = "http://192.168.0.4/test.txt";
$ftp_server = "192.168.0.4";
$ftp_user_name = "lilo";
$ftp_user_pass = "lilo";
// set up basic connection
$conn_id = ftp_connect("$ftp_server");
// login with username and password
$login_result = ftp_login($conn_id, "$ftp_user_name", "$ftp_user_pass");
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "Ftp connection has failed!";
echo "Attempted to connect to $ftp_server for user $user";
die;
} else {
echo "Connected to $ftp_server, for user $user";
}
// upload the file
$upload = ftp_put($conn_id, "$destination_file", "$source_file", FTP_BINARY);
// check upload status
if (!$upload) {
echo "Ftp upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
// close the FTP stream
ftp_quit($conn_id);
?>
warum öffnet fopen nicht die angeforderte datei? was mache ich falsch! ich möchte auf #eine datei aus dem netz zugreifen und auf keine lokale datei! wie stele ich das an? bitte um hilfe!
Kommentar