Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Validating files before upload
#3
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;
Reply


Messages In This Thread
Validating files before upload - by davenovo - 03-14-2018, 11:13 PM
RE: Validating files before upload - by davenovo - 03-16-2018, 01:15 AM
RE: Validating files before upload - by DanielFields - 03-16-2018, 05:14 AM
RE: Validating files before upload - by davenovo - 03-18-2018, 06:00 PM
RE: Validating files before upload - by kudzu - 03-19-2018, 01:26 PM
RE: Validating files before upload - by davenovo - 03-19-2018, 05:57 PM
RE: Validating files before upload - by davenovo - 03-19-2018, 08:44 PM
RE: Validating files before upload - by davenovo - 03-20-2018, 03:39 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)