Demo学习: FileUpload

FileUpload

文件上传,学习TUniFileUpload控件的使用

Demo学习: FileUpload

TUniFileUpload主要属性:

Filter: 文件类型过滤,这个属性在web模式下是无效的,UniGUI目前版本还没有实现此功能,比较有用的功能,希望作者尽快实现此功能;

MaxAllowedSize: 设置文件最大上传尺寸;

message标题以及消息文本,可翻译成中文,这个属性也做的不完整,个别消息文本没有提取出来;

TUniFileUpload控件目前最大的问题是不支持文件批量上传!

事件:OnCompleted(Sender: TObject; AStream: TFileStream)

负责文件上传完成后的处理,是把文件流保存到目标路径;

procedure TMainForm.UniFileUpload1Completed(Sender: TObject; AStream: TFileStream);
var
DestName : string;
DestFolder : string;
begin
if IsImage then
begin
UniImage1.Picture.LoadFromFile(AStream.FileName);
UniLabel3.Caption:='File Name: '+UniFileUpload1.FileName;
end
else
begin
DestFolder:=UniServerModule.StartPath+'UploadFolder\';
DestName:=DestFolder+ExtractFileName(UniFileUpload1.FileName);
UniLabel4.Caption:='File Name: '+UniFileUpload1.FileName;
CopyFile(PChar(AStream.FileName), PChar(DestName), False);
ShowMessage('File: '+UniFileUpload1.FileName+' Uploaded to folder: '+DestFolder);
end;
end;
上一篇:深度学习国外课程资料(Deep Learning for Self-Driving Cars)+(Deep Reinforcement Learning and Control )


下一篇:js Array对象