Look at the source file of CGFileUpload.pas
you can see at design-time that IWCGJQFileUpload.JQFileUploadOptions.OnComplete = TIWCGJQCustomFileUploadComplete
- Code: Select all
procedure TIWFileUploadFrame.TIWCGJQCustomFileUploadComplete(Sender: TObject;
AURLParams: TStringList);
var
i,c: Integer;
s: string;
begin
c:= IWCGJQFileUpload.FileNames.Count;
if c <= 0 then Exit;
s:= IntToStr(c) + ' file';
if c <> 1 then
s:= s + 's';
s:= s + ' downloaded:'+sLineBreak;
for i:= 0 to c-1 do
begin
s:= s + IWCGJQFileUpload.FileNames.Names[i] + sLineBreak;
end;
IWLabelStatus.Caption:= s;
IWCGJQDialog.Visible:= True;
end;
Since this component supports multifile upload, you can force single upload, setting
IWCGJQFileUpload.JQFileUploadOptions.Multiple:= False;
Like it's also described in the demo.
In this case you only need to get
FullFileName:= IWCGJQFileUpload.FileNames.ValuesByIndex[0]
that gives you the complete path of the file the user just uploaded,
IWCGJQFileUpload.FileNames.Names[0]
gives you the FileName part only
for gettting the extension use ExtractFileExt
for getting the size, you can use the util function above where you have to pass the FullFileName
please be sure to IWCGJQFileUploadFileNames.Clear, at the end of OnComplete
and thats it....