TUniFileUploadButton主要属性:
Filter: 文件类型过滤,有图片image/* audio/* video/*三种过滤
MaxAllowedSize: 设置文件最大上传尺寸;
Message:标题以及消息文本,可翻译成中文
TUniFileUploadButton控件目前最大的问题是不支持文件批量上传!
事件:OnCompleted(Sender: TObject; AStream: TFileStream)
procedure TMainForm.UniFileUploadButton1Completed(Sender: TObject; AStream: TFileStream); var DestName : string; DestFolder : string; begin //将 文件 加载到 UniImage1里 UniImage1.Picture.LoadFromFile(AStream.FileName); Caption:='File Name: '+UniFileUploadButton1.FileName; //将 文件 保存到UploadFolder文件夹,先要创建这个UploadFolder文件夹 DestFolder:=UniServerModule.StartPath+'UploadFolder'; //要在与exe同下新建一个UploadFolder文件夹 DestName:=DestFolder+ExtractFileName(UniFileUploadButton1.FileName); CopyFile(PChar(AStream.FileName), PChar(DestName), False); ShowMessage('File: '+UniFileUploadButton1.FileName+' Uploaded to folder: '+DestFolder); end;
内容来源于网络如有侵权请私信删除
文章来源: 博客园
- 还没有人评论,欢迎说说您的想法!