Atozed Forums
How do I start the IWFileUploader upload function in another component's click event? - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: How do I start the IWFileUploader upload function in another component's click event? (/thread-1839.html)



How do I start the IWFileUploader upload function in another component's click event? - brsoft - 08-03-2020

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


RE: How do I start the IWFileUploader upload function in another component's click event? - Jose Nilton Pace - 08-03-2020

Hi. Select your IWImageFile, Properties, ScriptEvents, OnClick:
Code:
IW.FileUploader("IWFILEUPLOADER1").selectFile();



RE: How do I start the IWFileUploader upload function in another component's click event? - brsoft - 08-04-2020

(08-03-2020, 07:14 PM)Jose Nilton Pace Wrote: Hi. Select your IWImageFile, Properties, ScriptEvents, OnClick:
Code:
IW.FileUploader("IWFILEUPLOADER1").selectFile();

Big thanks! Smile


RE: How do I start the IWFileUploader upload function in another component's click event? - Lorbass - 08-05-2020

(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


RE: How do I start the IWFileUploader upload function in another component's click event? - kudzu - 08-05-2020

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


RE: How do I start the IWFileUploader upload function in another component's click event? - brsoft - 08-05-2020

(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 műveletek ...]
UPL.Visible:=False;
end;
...


RE: How do I start the IWFileUploader upload function in another component's click event? - Lorbass - 08-05-2020

(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 műveletek ...]
UPL.Visible:=False;
end;
...

Many thanks for answers!

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


RE: How do I start the IWFileUploader upload function in another component's click event? - DanBarclay - 08-06-2020

Sometimes the light is a train.   Tongue Big Grin

Dan