[FTP Upload] Warning: ftp_put() [function.ftp-put]

Irgendwelche Probleme mit XAMPP für Windows? Dann ist hier genau der richtige Ort um nachzufragen.

[FTP Upload] Warning: ftp_put() [function.ftp-put]

Postby raid89 » 18. February 2011 07:23

Hallo, ich versuche einen FTP Upload Script zu bauen. Leider bekomme ich immer die Fehlermeldung Warning: ftp_put() [function.ftp-put].

Im Internet bin ich auch schon fündig geworden. Glaube ich zumindest.

Um die FTP-Funktionen zu verwenden, muss die Option --enable-ftp bei der Installation von PHP verwendet werden.


Wo kann ich diese Funktion bei XAMPP Aktivieren?

LG
Martin
raid89
 
Posts: 5
Joined: 18. February 2011 07:19

Re: [FTP Upload] Warning: ftp_put() [function.ftp-put]

Postby WilliL » 18. February 2011 12:32

hast du denn den FTP-Server Filezilla aktiviert?
Willi
WilliL
 
Posts: 660
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1

Re: [FTP Upload] Warning: ftp_put() [function.ftp-put]

Postby raid89 » 18. February 2011 13:03

Ja, ist aktiv.
raid89
 
Posts: 5
Joined: 18. February 2011 07:19

Re: [FTP Upload] Warning: ftp_put() [function.ftp-put]

Postby WilliL » 18. February 2011 13:28

hast du deinen Script hier mal gegengeprüft?
http://www.php.net/manual/en/function.ftp-put.php
bei Xampp 1.7.4 gibt es ein BSP im Ordner /contrib/ftp-mit-php.php
Willi
WilliL
 
Posts: 660
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1

Re: [FTP Upload] Warning: ftp_put() [function.ftp-put]

Postby raid89 » 18. February 2011 13:34

Jo, geht mit dem Script. Das ging aber auch mit meinem Script das ich eine Verbindung bekommen habe. Es geht nur nicht das ich Daten auf dem FTP Server ablegen kann. :cry:

Was ein "Upload" Script ja machen soll.
raid89
 
Posts: 5
Joined: 18. February 2011 07:19

Re: [FTP Upload] Warning: ftp_put() [function.ftp-put]

Postby raid89 » 18. February 2011 13:36

Jetzt bekomme ich immer die meldung.

Code: Select all
Verbunden mit ..... als Benutzer f004c956
/./ [DIR]
/../ [DIR]
/Messestand.ai
/Adapterset Akkupack.jpg

Warning: ftp_put() [function.ftp-put]: Filename cannot be empty in C:\xampp\htdocs\ftp-mit-php.php on line 39

Warning: ftp_get() [function.ftp-get]: Filename cannot be empty in C:\xampp\htdocs\ftp-mit-php.php on line 42

Warning: ftp_get() [function.ftp-get]: Error opening in C:\xampp\htdocs\ftp-mit-php.php on line 42

Warning: ftp_delete() [function.ftp-delete]: Invalid number of arguments in C:\xampp\htdocs\ftp-mit-php.php on line 45


Mit diesem Script von XAMPP

Code: Select all
<?php
$host="...";
$user="f004c956";
$password="intranet123";

// Herstellen der Basis-Verbindung
$conn_id = ftp_connect($host);

// Einloggen mit Benutzername und Kennwort
$login_result = ftp_login($conn_id, $user, $password);

// Verbindung überprüfen
if ((!$conn_id) || (!$login_result)) {
        echo "Ftp-Verbindung nicht hergestellt!";
        echo "Verbindung mit $host als Benutzer $user nicht möglich";
        die;
    } else {
        echo "Verbunden mit $host als Benutzer $user";
    }

print "<br>";
$path="/";
$dir = "";
///// List 
$files=ftp_nlist($conn_id, "$path");
foreach ($files as $file) {
 $isfile = ftp_size($conn_id, $file);
 if($isfile == "-1") { // Ist ein Verzeichnis
  print $file."/ [DIR]<br>";
 }
 else {
  $filelist[(count($filelist)+1)] = $file; // Ist eine Verzeichnis
  print $file."<br>";
 }
}


///// Upload
ftp_put($conn_id, $remote_file_path, $local_file_path, FTP_BINARY);
 
///// Download
ftp_get($conn_id, $local_file_path, $remote_file_path, FTP_BINARY);

///// Löschen einer Datei
ftp_delete ($conn_id, $remote_file_path);


// Schließen des FTP-Streams
ftp_quit($conn_id);
?>
raid89
 
Posts: 5
Joined: 18. February 2011 07:19

Re: [FTP Upload] Warning: ftp_put() [function.ftp-put]

Postby WilliL » 18. February 2011 18:51

mal mit Stings, also direkten Namen versucht?
PHP gibt ja entsprechende Warnungen
- Filename cannot be empty
Willi
WilliL
 
Posts: 660
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1

Re: [FTP Upload] Warning: ftp_put() [function.ftp-put]

Postby raid89 » 21. February 2011 08:18

Ich bin PHP Anfänger. :roll:

WIe meinst du das. Könntest du mir das an einem Beispiel erklären?

LG Martin
raid89
 
Posts: 5
Joined: 18. February 2011 07:19

Re: [FTP Upload] Warning: ftp_put() [function.ftp-put]

Postby WilliL » 21. February 2011 17:53

lesen, probieren.. und wieder lesen ;)

ich habe das Originalscript aus XAMPP 1.7.4 genommen und entsprechend geändert.
Infos dazu habe ich mir z.B. hier http://php.net/manual/de/function.ftp-put.php geholt

Code: Select all
...
$conn_id = ftp_connect($host);
// ftp_put | ftp_get | ftp_delete geht
//$remote_file_path='./upload/test.htm';
//$local_file_path='./index.htm';     
$remote_file_path='./upload/test.htm';
$local_file_path='c:/index.htm';
...
 if($isfile == "-1") { // Ist ein Verzeichnis
 //ftp_put($conn_id, $remote_file_path, $local_file_path, FTP_BINARY);
 //ftp_get($conn_id, $local_file_path, $remote_file_path, FTP_BINARY);
 //ftp_delete ($conn_id, $remote_file_path);
  print $file."/ [DIR]<br>";
...
Willi
WilliL
 
Posts: 660
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1


Return to XAMPP für Windows

Who is online

Users browsing this forum: No registered users and 19 guests