IntraWeb Application Locks down while Sending file to browser as attachment

313 views Asked by At

i am trying to deploy a web application using intraweb 14.0.32 , delphi xe6 and MSSQL server. i need to show attachment of a mail while user clicks on file name . here is my code to perform that operation . problem is while user clicks on link to show attachment, file will download to user's computer but application locks down showing a loading page. so please help me identifying problem. thank you.

procedure TMailMgr_f.IWDBGrid2Columns0Click(ASender: TObject;const AValue: string);
    var
       blob:TStream;
       qryAttach:TADOQuery;
       fileName:string;
    begin
        qryAttach:=TADOQuery.Create(self);
        qryAttach.Connection:=ADOConnection1;
        qryAttach.SQL.Add(format('SELECT OrginalFileName,Attachment FROM Mail_Attachmentwhereid=%s'[AValue]));
        qryAttach.Active:=true;
     blob := qryAttach.CreateBlobStream(qryAttach.FieldByName('Attachment'),
         bmRead);
     fileName:=qryAttach.FieldByName('OrginalFileName').AsString;
         qryAttach.Close;
     WebApplication.SendStream(blob,true,'image/jpeg',fileName);
    end;
1

There are 1 answers

1
TPACK On

OK, I found my answer and I just want to mention it here for people who may have similar problem.

you just need to set "lockonsubmit" property of form to be false and this will remove that buggy lock.