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



BeitragVerfasst: Do 04.06.09 16:15 
Hey,
habe ein Programm, indem ich folgende Variable deklariere. Der Code ist aus dem Internet.
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
unit Unit1;

interface

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls,
    CHILKATFTP2Lib_TLB,
    OleCtrls;


type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;

    procedure FormShow(Sender: TObject);
  private
    procedure Upload;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation


{$R *.dfm}
procedure TForm1.Upload;
var
ftp: TChilkatFtp2;
success: Integer;
localFilename: String;
remoteFilename: String;

begin
ftp := TChilkatFtp2.Create(Self);

//  Any string unlocks the component for the 1st 30-days.
success := ftp.UnlockComponent('Anything for 30-day trial');
if (success <> 1then
  begin
    ShowMessage(ftp.LastErrorText);

  end;

ftp.Hostname := 'ftp.chilkatsoft.com';
ftp.Username := '****';
ftp.Password := '****';

//  The default data transfer mode is "Active" as opposed to "Passive".

//  Connect and login to the FTP server.
success := ftp.Connect();
if (success <> 1then
  begin
    ShowMessage(ftp.LastErrorText);

  end;

//  Change to the remote directory where the file will be uploaded.
success := ftp.ChangeRemoteDir('junk');
if (success <> 1then
  begin
    ShowMessage(ftp.LastErrorText);

  end;

//  Upload a file.
localFilename := 'c:/temp/hamlet.xml';
remoteFilename := 'hamlet.xml';

success := ftp.PutFile(localFilename,remoteFilename);
if (success <> 1then
  begin
    ShowMessage(ftp.LastErrorText);

  end;

ftp.Disconnect();

ShowMessage('File Uploaded!');
end;


procedure TForm1.FormShow(Sender: TObject);
var Owner : HWnd;
begin
  Upload;
  Owner:=GetWindow(Handle,GW_OWNER);
  ShowWindow(Owner,SW_HIDE);
end;
end.


Folgende Fehlermeldung kommt immer:
[Fataler Fehler] Unit1.pas(8): Datei nicht gefunden: 'CHILKATFTP2Lib_TLB.dcu'

Was heißt das, bzw welche Datei kanner nicht finden und wo bekomme ich diese her?
Grüße.
j.klugmann
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 04.06.09 16:18 
Moin!

Da fehlt eine Unit.Ich würde einfach mal nach CHILKATFTP2Lib_TLB googlen und dann downloaden.
Anschließend einfach ins Lib Verzeichnis von Delphi

MfG
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 04.06.09 16:37 
Es handelt sich dabei, wenn ich mich recht entsinne, um eine kostenpflichtige Komponente für de FTP-Zugriff. Die musst du dir also kaufen, wenn du die statt z.B. TIdFTP von den Indys nutzen willst.

// EDIT:
Ja, dem ist so. Es gibt auch eine kostenlose FTP-Komponente dort, aber die FTP 2 ist nicht kostenlos.
www.chilkatsoft.com/ChilkatFtp.asp

Nebenbei: Was geht denn mit Indy nicht, dass du lieber eine DLL und ActiveX nutzen willst, denn das ist da es ja, wenn ich das richtig sehe...
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 04.06.09 16:47 
Ehrlich gesagt, habe ich keine Ahnung. Ich hab einfach gegoogelt und bin auf den Code gestoßen und als Erklärung stand dabei: "Upload von Dateien per FTP mit Delphi". Das war genau das was ich gesucht habe. Daurm hab ich den Code einfach kopiert.
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 04.06.09 16:49 
Ich rate dir einfach TIdFTP zu benutzen, das ist z.B. bei Turbo Delphi direkt verfügbar. Einfach IdFTP in die uses schreiben und die Klasse erzeugen und benutzen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
  MyFTP: TIdFTP;
begin
  MyFTP := TIdFTP.Create;
  try
    MyFTP. ...
  finally
    MyFTP.Free;
  end;
end;
Nebenbei muss dir klar sein, dass jeder, dem du ein solches Programm gibst, das auf einen FTP-Server zugreift, auch das Passwort und die anderen Logindaten dann hat. Denn das gibst du demjenigen ja direkt mit dem Programm mit.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 04.06.09 16:57 
Das weiß ich, vielen Dank, werde mal versuchen deinen AnfangsCode zu vollenden.

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

Ich hab Delphi 7 PE und da ist es anscheind nicht vorhanden.
E.: Finde aber auch keinen Download-Link..
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 04.06.09 17:04 
Nicht standardmäßig bei D7 PE, also musst du es entweder herunterladen oder einfach das einige Jahre neuere und komfortablere Turbo Delphi benutzen.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 04.06.09 17:24 
Habe mir jetzt erstmal nur die indy10.zip heruntergeladen. Ist das die richtige Datei? Was muss ich jetzt damit machen, sorry kenne mich noch garnicht aus.
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 04.06.09 17:31 
Dann würde ich an deiner Stelle Turbo Delphi nehmen, da musst du gar nichts weiter machen...

Für D7:
Als erstes musst du die Datei irgendwohin entpacken. Dann gibt es die Datei .\Lib\Fulld7.bat, bei mir sehe ich da keinen Effekt, wenn ich die ausführe, vielleicht funktioniert sie bei dir.
Sonst musst du die Ordner .\Lib\Core, .\Lib\Protocols, .\Lib\Security, .\Lib\SuperCore und .\Lib\System dem Bibliothekspfad hinzufügen. (Tools --> Optionen --> Verzeichnisse/Bedingungen --> Bibliothekspfad oder so ähnlich)
Und wenn du das möchtest musst du dann noch die Packages alle installieren.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Do 04.06.09 17:38 
Scheint bei mir auch keine Wirkung zu haben, werde nach dem Training mal TurboDelphi probieren.
Grüße