How do I start the IWFileUploader upload function in another component's click event?

<< Click to Display Table of Contents >>

Navigation:  Forum >

How do I start the IWFileUploader upload function in another component's click event?

Forum link

 


 

08-03-2020, 06:53 AM:

 

Hi

 

How do I start the IWFileUploader upload function in another component's onclick event?

 

E.g.:

 

procedure TForm1.IWImageFile1AsyncClick (Sender: TObject; EventParams: TStringList);

 

begin

 

[... run IWFileUploader upload function ...]

 

end;

 

I am using version IW15.1.22.

 

Regards

 

Robert

 


 

08-03-2020, 07:14 PM:

 

Hi. Select your IWImageFile, Properties, ScriptEvents, OnClick:

 

Code:

 

IW.FileUploader("IWFILEUPLOADER1").selectFile();

 

 

 


 

08-04-2020, 06:33 AM:

 

(08-03-2020, 07:14 PM)Jose Nilton Pace Wrote: [ -> ]Hi. Select your IWImageFile, Properties, ScriptEvents, OnClick:

 

Code:

 

IW.FileUploader("IWFILEUPLOADER1").selectFile();

 

 

 

Big thanks!

 


 

08-05-2020, 03:03 PM:

 

(08-03-2020, 07:14 PM)Jose Nilton Pace Wrote: [ -> ]Hi. Select your IWImageFile, Properties, ScriptEvents, OnClick:

 

Code:

 

IW.FileUploader("IWFILEUPLOADER1").selectFile();

 

 

 

Hi and thanks for the answer to Robert because I want to do in the same way!

 

BUT Delphi generates an error: E2242: 'FileUploader' is not a name of a unit

 

Something wrong?

 

Best regards and thanks for answer

 

Lorbass

 


 

08-05-2020, 03:53 PM:

 

This is Javascript, it goes in ScriptEvents.OnClick, not the Delphi OnClick.

 


 

08-05-2020, 04:58 PM:

 

(08-05-2020, 03:03 PM)Lorbass Wrote: [ -> ] (08-03-2020, 07:14 PM)Jose Nilton Pace Wrote: [ -> ]Hi. Select your IWImageFile, Properties, ScriptEvents, OnClick:

 

Code:

 

IW.FileUploader("IWFILEUPLOADER1").selectFile();

 

 

 

Hi and thanks for the answer to Robert because I want to do in the same way!

 

BUT Delphi generates an error: E2242: 'FileUploader' is not a name of a unit

 

Something wrong?

 

Best regards and thanks for answer

 

Lorbass

 

Hi

 

In javascript, use the name of the TIWFileUploader component on the Form.

 

More info:

 

The onAsyncUploadCompleted event of the TIWFileUploader component works only in visible mode.

 

Currently this code (but I'm still trying to fix it):

 

UPL: TIWFileUploader; // UPL visible: false

 

// IWImageFile ScriptEvents "onclick": 'IW.FileUploader("UPL").selectFile();'

 

...

 

procedure TModifyConfig.UPLAsyncSelectFile(Sender: TObject; EventParams: TStringList);

 

begin

 

UPL.Visible:=True;

 

end;

 

...

 

procedure TModifyConfig.UPLAsyncUploadCompleted(Sender: TObject; var DestPath, FileName: string; var SaveFile, Overwrite: Boolean);

 

begin

 

[... fájl muveletek ...]

 

UPL.Visible:=False;

 

end;

 

...

 


 

08-05-2020, 07:55 PM:

 

(08-05-2020, 04:58 PM)brsoft Wrote: [ -> ] (08-05-2020, 03:03 PM)Lorbass Wrote: [ -> ] (08-03-2020, 07:14 PM)Jose Nilton Pace Wrote: [ -> ]Hi. Select your IWImageFile, Properties, ScriptEvents, OnClick:

 

Code:

 

IW.FileUploader("IWFILEUPLOADER1").selectFile();

 

 

 

Hi and thanks for the answer to Robert because I want to do in the same way!

 

BUT Delphi generates an error: E2242: 'FileUploader' is not a name of a unit

 

Something wrong?

 

Best regards and thanks for answer

 

Lorbass

 

Hi

 

In javascript, use the name of the TIWFileUploader component on the Form.

 

More info:

 

The onAsyncUploadCompleted event of the TIWFileUploader component works only in visible mode.

 

Currently this code (but I'm still trying to fix it):

 

UPL: TIWFileUploader; // UPL visible: false

 

// IWImageFile ScriptEvents "onclick": 'IW.FileUploader("UPL").selectFile();'

 

...

 

procedure TModifyConfig.UPLAsyncSelectFile(Sender: TObject; EventParams: TStringList);

 

begin

 

UPL.Visible:=True;

 

end;

 

...

 

procedure TModifyConfig.UPLAsyncUploadCompleted(Sender: TObject; var DestPath, FileName: string; var SaveFile, Overwrite: Boolean);

 

begin

 

[... fájl muveletek ...]

 

UPL.Visible:=False;

 

end;

 

...

 

Many thanks for answers!

 

In Version 15.2.10 it works fine - also if FileUploader is invisible!

 


 

08-06-2020, 06:38 AM:

 

Sometimes the light is a train.   

 

Dan