FTP上传示例代码

 

FTP上传示例代码FTP上传示例代码Code
//Little sample showing how to upload file to a FTP using
//Wininet component. :D


program upoader;

{$apptype console}

uses
windows,
wininet;



var
intconn,intopen : hinternet;

procedure UploadMyFile (File2Upload:pchar; targetfilename:pchar);
const
TheFtpPort
=21;
begin
writeln(
'Starting upload of file: '+File2upload);
writeln(
'Connecting to FTPFTP上传示例代码');
intopen :
= internetopen('iexplore',INTERNET_OPEN_TYPE_DIRECT,nil,nil,0);
intconn :
= internetconnect(intopen,'ftp.lycos.co.uk',TheFtpPort,'MyUsername','MyPassword',INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE,0);

sleep(
100);
if getlasterror=0 then writeln('uploading nowFTP上传示例代码..'else writeln('COULD NOT CONNECT!!');

ftpputfile(intconn,File2Upload,targetfilename,FTP_TRANSFER_TYPE_UNKNOWN,
0);
internetclosehandle(intconn);
internetclosehandle(intopen) ;
if getlasterror=0 then writeln(File2upload+' was sucessfully uploaded to FTP as: '+targetfilename) else sleep(1);

END;


begin


uploadmyfile(
'C:\warning.wav','Uploadedfile.wav');


while True do Sleep(1000);


end.

 

转载于:https://www.cnblogs.com/bsoom/archive/2009/11/14/1603066.html

相关文章:

  • 2021-06-02
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2021-11-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
相关资源
相似解决方案