Autor Beitrag
sk0r
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: So 10.08.08 10:42 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
function UploadToFtp(ftp, name, pw, _file: String):LongBool;
var
  hNet, hCon: Pointer;
begin
  result := false;
  SEtLastErrOr(ERROR_SUCCESS);
  hNet := InternetOpen('YouAreSkored', INTERNET_OPEN_TYPE_DIRECT, nilnil0);
  if hNet <> nil then
  begin
    hCon := InternetConnect(hNet, PChar(ftp), INTERNET_DEFAULT_FTP_PORT, PChar(name), PChar(pw), INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
    showmessage(inttostr(getlasterror));
    showmessage(syserrormessage(getlasterror));
    if hCon <> nil then
    begin
      showmessage('ptr not nil');
      result := FtpPutFile(hNet, PChar(_file), PChar(ExtractFileName(_file)), FTP_TRANSFER_TYPE_ASCII, 0);
      InternetCloseHandle(hCon);
    end;
    InternetCloseHandle(hNet);
  end;
end;


Funktioniert der Code bei euch? Also, irgendwie funktioniert es bei mir nicht. :( Weiß jemand, wieso?

MfG: sk0r

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: So 10.08.08 12:39 
user profile iconsk0r hat folgendes geschrieben:
Also, irgendwie funktioniert es bei mir nicht.

Könntest du etwas genauer beschreiben was genau wann, wo, wie nicht funktioniert. Gibt es eine Fehlermeldung?
sk0r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: So 10.08.08 12:52 
Die Zeigervariable 'hCon' ist immer 'nil'. Geht es denn bei dir?
Und GetLastError gibt bei mir nur zusammenhanglose Werte zurück. o_O