FTP-Upload mit PHP

Seite 1 von 1 - Forum: Coding Stuff auf overclockers.at

URL: https://www.overclockers.at/coding-stuff/ftp-upload_mit_php_33229/page_1 - zur Vollversion wechseln!


jives schrieb am 02.05.2002 um 23:03

Kann mir bitte jemand dabei helfen?
Scheinbar funktioniert ftp_put nicht, es liefert FALSE.

Code: PHP
if (($upload == "rec") && ($src_file)) {
	$conn_id = ftp_connect($ftp_rec_host);

	//Einloggen
	$login_result = ftp_login($conn_id, $ftp_rec_user, $ftp_rec_pass);

	//Verbindung ok?
	if ((!$conn_id) || (!$login_result)) {
		echo "FTP-Access denided.";
		die;
	}

	//Upload
	echo "$src_file<br>";
	$upload = ftp_put($conn_id, "test.zip", "$src_file", FTP_BINARY);

	//Upload ok?
	if (!$upload) {
		echo "<font face=\"Arial\" size=\"2\" color=\"red\">An error has occured while trying to upload $src_file</font>";
	} else {
		echo "Uploaded $src_file successfully.";
	}

	//FTP-Stream beenden
	ftp_quit($conn_id);
} else {
	echo "<font face=\"Arial\" size=\"2\" color=\"red\">Please specify a file!</font>";
}

Thx in advance :)


that schrieb am 02.05.2002 um 23:07

Schreibrechte im Directory?


jives schrieb am 03.05.2002 um 18:51

Jap. Ich habs mit allem möglichen probiert, 777, 666 usw. Geht alles nicht :(
"Merkt" der Server eigentlich, ob ich per script oder per FTP-Client uppe?


Vir@s schrieb am 03.05.2002 um 19:26

Ähm.... vielleicht seh ich des falsch - aber die Parameter sind bei dir nicht richtig:

bool ftp_put ( resource ftp_stream, string remote_file, string local_file, int mode)

du hast:

bool ftp_put ( resource ftp_stream, string local_file, string remote_file, int mode)

kann natürlich auch sein des ich des jetzt falsch seh :/

http://www.php.net/manual/en/function.ftp-put.php


jives schrieb am 03.05.2002 um 20:05

Nein, $src_file ist die Datei die lokal auf dem Computer liegt. "test.zip" ist nur zum testen ;)


that schrieb am 03.05.2002 um 21:50

Zitat von KaZaa
Jap. Ich habs mit allem möglichen probiert, 777, 666 usw. Geht alles nicht :(
"Merkt" der Server eigentlich, ob ich per script oder per FTP-Client uppe?

Kommt drauf an, aber möglicherweise ist einfach das Directory falsch?


funka schrieb am 03.05.2002 um 22:05

was that sagen will is:
bist du im richtigen dir?
tests mal per normalen ftp client oder nim mm absolute pfade

und nein es sollte keinen unterschied fuer server machen


Vir@s schrieb am 04.05.2002 um 07:10

Wie groß ist die Test-File?

Bei PHP sind Default nur Files <2MB!!!


grOOvekill@ schrieb am 04.05.2002 um 15:58

Ich bilde mir ein, schon mal irgendwo gelesen zu haben, daß ftp_put manchmal Schwierigkeiten bereiten kann. Wieso versuchst du's nicht mit post?

Nur so'n Gedanke...;)




overclockers.at v4.thecommunity
© all rights reserved by overclockers.at 2000-2025