03-16-2018, 05:14 AM
Here is some old code that I tried along those lines. It worked in my simple testing.
Code:
private
FileRejected : Boolean;
procedure TFormUITest.IWFileUploader1AsyncSelectFile(Sender: TObject; EventParams: TStringList);
begin
if FileRejected then
WebApplication.ShowMessage('REJECTED! IWFileUploader1AsyncSelectFile(Sender, '+EventParams.Text+')');
end;
procedure TFormUITest.IWFileUploader1AsyncUploadCompleted(Sender: TObject; var DestPath, FileName: string; var SaveFile, Overwrite: Boolean);
begin
FileRejected := false;
DestPath := WebApplication.ApplicationPath+'\wwwroot\files\uploads\';
SaveFile := Pos('magicky',FileName)=1;
if not SaveFile then
begin
FileRejected := true;
end;
end;
procedure TFormUITest.IWFileUploader1AsyncUploadSuccess(Sender: TObject; EventParams: TStringList);
begin
//WebApplication.ShowMessage(EventParams.Text);
end;
