⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 实例——实现文件的下载上传.txt

📁 冒泡排序延时请认真阅读您的文件包然后写出其具体功能(至少要20个字)。尽量不要让站长把时间都花费在为您修正说明上。压缩包解压时不能有密码。系统会自动删除debug和release目录
💻 TXT
字号:
unit IWUnit1;
{PUBDIST}

interface

uses
  IWAppForm, IWApplication, IWTypes, IWCompButton, Classes, Controls,
  IWControl, IWCompListbox, IWCompEdit, IWHTMLControls, IWCompLabel, Forms,
  IWContainer, IWRegion, IWGrids;

type
  TformUpDown = class(TIWAppForm)
    IWHRule1: TIWHRule;
    IWRegion1: TIWRegion;
    IWButton1: TIWButton;
    lboxFiles: TIWListbox;
    IWRegion2: TIWRegion;
    IWFile1: TIWFile;
    IWButton2: TIWButton;
    lablFileInfo: TIWLabel;
    procedure IWAppFormCreate(Sender: TObject);
    procedure IWButton1Click(Sender: TObject);
    procedure IWButton2Click(Sender: TObject);
  public
    FPath: string;
  end;

implementation
{$R *.dfm}

uses
    SysUtils, SWSystem;

procedure TformUpDown.IWAppFormCreate(Sender: TObject);
var
  i: Integer;
  LSrch: TSearchRec;
begin
  lboxFiles.Items.Clear ;
  FPath := gsAppPath + 'Downloads\';
  i := FindFirst(FPath + '*.*', faAnyFile, LSrch); try   
    while i = 0 do begin
      if (LSrch.Attr and faDirectory) = 0 then
        lboxFiles.Items.Add(LSrch.Name);   
      i := FindNext(LSrch);
    end;
  finally FindClose(LSrch); end;
  lboxFiles.ItemIndex := 0;
end;

procedure TformUpDown.IWButton1Click(Sender: TObject);
begin
  if lboxFiles.ItemIndex > -1 then begin
    WebApplication.SendFile(FPath + lboxFiles.Text, '', '', true);
  end;
end;

procedure TformUpDown.IWButton2Click(Sender: TObject);
begin
  IWFIle1.SaveToFile(ExtractFilePath(ParamStr(0))+ 'Downloads\' + IWFile1.FileName);
  lablFileInfo.Caption := IWFile1.Filename +' 上传成功! ' +  #13#10 +
  '文件已经成功保存到: ' + ExtractFilePath(ParamStr(0))+ 'Downloads\';
  lablFileInfo.Visible := True;
  IWAppFormCreate(nil);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -