Autor Beitrag
Robii
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 11.06.09 01:43 
Hey, habe TurboDelphi und würde gerne wissen, wie ich Dateien per FTP Up oder Down loade?
Vielen Dank schonmal.

(Beispiel Code oder Funktionen + Erklärung wären nett)
Dunkel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 682

Mac OS X Snow Leopard
Xcode 3.1
BeitragVerfasst: Do 11.06.09 01:49 
Hallo!

Wenn es ums Internetz geht, dann werden auch immer ganz schnell die INDYs (Suche in der Entwickler-Ecke INDY FTP) genannt. Probier es mal damit!

_________________
Ich streite einsam mich mit dieser Oberflächenwelt
Gutes sei ein löblich Brot von dem ich zehre - bis zum Tod [Das Ich - Im Ich]
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 11.06.09 01:56 
Irgendwie, werde ich daraus nicht so ganz schlau. Ich googel mal weiter.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 11.06.09 19:09 
So ungefähr: ;-)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
uses
  IdFTP;

...

var
  MyIdFTP: TIdFTP;
begin
  MyIdFTP := TIdFTP.Create;
  try
    MyIdFTP.UserName...
    MyIdFTP....
    
    MyIdFTP.Get / Put
  finally
    MyIdFTP.Free;
  end;
end;
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 11.06.09 20:38 
Moderiert von user profile iconNarses: Komplett-Zitat des letzten Beitrags entfernt.

Den Text verstehe ich nicht genau. Ich ordne da doch nur die Daten zu oder nicht? Sorry,
verstehe das nicht so ganz.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 11.06.09 20:42 
Du musst die Instanz der Klasse erzeugen, die Logindaten festlegen, verbinden (das hab ich jetzt nicht extra alles geschrieben...), die Dateioperationen mit Get/Put durchführen und die Instanz der Klasse wieder freigeben.

Das kann man natürlich ggf. auch auseinanderziehen, wenn du mehrere Operationen durchführen willst. Also z.B. erzeugen in OnCreate und Freigeben in OnDestroy und ansonsten einfach benutzen.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 11.06.09 21:06 
Ok vielen Dank. Wo finde ich den all diese Funktionen + Erklärung, meistens gibt es ja eine Datei in der jede Funktion einzelnd erklärt wird.
Gruß
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 11.06.09 21:09 
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 11.06.09 21:11 
Leicht auf der Webseite des Projekts zu finden:
www.indyproject.org/...;frmfile=TIdFTP.html

Alternative:
Auf der Dokumentationsseite die erste Datei (MS HTML Help 2) herunterladen und ins Delphi-Hilfeverzeichnis packen (siehe Readme), dann funktioniert auch F1.
www.indyproject.org/...s/Docs/index.DE.aspx

// EDIT:
Außerdem sind die doch bei Turbo Delphi eh schon dabei, da sollte F1 drücken ohnehin reichen.
Die neuen Downloads braucht man nur für eine neue Version, wenn man die herunterlädt.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 11.06.09 21:27 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.FormCreate(Sender: TObject);
var
  MyIdFTP: TIdFTP;
begin
  MyIdFTP := TIdFTP.Create;
  try
    MyIdFTP.UserName:='****';
    MyIdFTP.Password:='****';
    MyIdFTP.Host:='ftp.****.**.funpic.de';
    MyIdFTP.Put('C:\Test.Txt','Test.Txt');
  finally
    MyIdFTP.Free;
  end;
end;


Das hab ich bis jetzt gemacht, leider kommen immer Fehler, das ich eine Zugriffsverletzung habe.

Fehlt da noch etwas, wenn ich googel, werden da immer noch Sachen wie MyIdFTP.Connect genutzt, weiß
aber nicht genau was das ist.

Gruß.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 11.06.09 21:36 
Ja, nach dem Zuweisen der Zugangsdaten kommt noch Connect, ja... :roll:
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 11.06.09 21:38 
Und was genau muss ich bei Connect machen?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 11.06.09 21:46 
Was meinst du? Du musst es aufrufen. :gruebel:
Dass to connect auf deutsch verbinden heißt, ist dir hoffentlich klar, oder? Damit stellst du die Verbindung her, steht ja notfalls auch in der Hilfe, wenns nicht eh schon klar ist...
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 11.06.09 21:47 
Das connect verbinden heißt ist mir natürlich klar, ich meine aber wie soll ich es aufrufen?
ausblenden Delphi-Quelltext
1:
MyFtp.Connect(???)					


Was muss an Stelle der Fragezeichen stehen?
Gruß

E.: Sorry, dumme Frage, hat sich selbst geklärt. Folgende Fehlermeldung erhalte ich trotzdem noch:

Zugriffsverletzung bei Adresse 0047E85A in Module 'Project1.exe' Lesen von Adresse 0000004C.

Gruß
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 11.06.09 21:50 
Also bei mir gibts da keine Parameter und in der Dokumentation auch nicht. :gruebel:

Die Syntaxergänzung muss dir doch anzeigen welche Parameter du da schreiben sollst...
Und wenn bei Klammer auf da steht, dass keine erwartet werden, dann ist das auch so.

// EDIT:
Ich weiß nicht, ob Connect sofort ausgeführt wird, eigentlich dachte ich schon. Wenn nicht, musst du erst warten, bis wirklich verbunden wurde (OnConnect oder so).
Hmm, muss ich mal testen, aber erst hab ich kurz was anderes zu tun.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 11.06.09 21:55 
Ja, der Abend ist ja noch jung. Habe jetzt folgenden Quellcode:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.Upload;
var
  MyIdFTP: TIdFTP;
begin
  MyIdFTP := TIdFTP.Create;
  try
    MyIdFTP.UserName:='****';
    MyIdFTP.Password:='****';
    MyIdFTP.Host:='ftp.****.**.funpic.de';
    MyIdFTP.Connect;
    MyIdFTP.Put('C:\Test.Txt','Test.Txt');
  finally
    MyIdFTP.Free;
  end;
end;


Jetzt bekomme ich keine Fehlermeldung mehr, aber wenn ich auf meinem Ftp-Server nachschaue wurde auch keine Datei hochgeladen. Weiß jemand wieso?

Gruß


E: Klappt jetzt. Vielen Dank für die Hilfe
Gruß
wernerli12
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Mi 09.12.09 18:26 
Hallo, ich habe euren thred aufmerksam gelesen und soweit auch alles hinbekommen.
Nur zeigt er mir beim Compilieren folgende Fehlermeldung:

[Fehler] main.pas(94): Nicht genügend wirkliche Parameter

und verweist auf die Quellcode-Zeile:
MyIdFTP := TIdFTP.Create;

Kann mir jemand einen Tipp geben, wo der Fehler liegt?
Danke!
Airtrox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109


Delphi 7
BeitragVerfasst: Mi 09.12.09 18:47 
Was steht denn darunter? Die Variable hast du definiert und idFTP steht in der uses?
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mi 09.12.09 18:49 
Create erwartet den Owner als Parameter, also (self)

_________________
PROGRAMMER: A device for converting coffee into software.
wernerli12
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Do 10.12.09 00:48 
'self' hat gefehlt.
vielen dank für eure schnellen antworten.