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, nil, nil, 0); 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; |