Jump to content

How to download file that the server just generate after button click


AMIT

Recommended Posts

Please give me some suggestion how to download file that the server just generate after button click. I have a unidbgrid displaying the data that users selected from their desired criteria. I need to have one button for them to download this data after they click on it. This file will be generated at the server after the users click on the button. The file may be Text, XLS or whatever format (this I can do it on the server). After it was generated it should be automatically send back to user by letting them select the folder to store the file (this I need suggestion). Anyway, Thank in advance for any suggestions that may have.

Link to comment
Share on other sites

A workaround working for me (until Farshad implements the SendFile):

 

s := UniServerModule.LocalCachePath + 'imagen'+IntToStr(GetTickCount)+'.bmp';

TBlobField(Qclaus.FieldByName('imatge')).SaveToFile(s);

s := Copy(s,Pos('cache',s),255);

s := StringReplace(s,'\','/',[rfReplaceAll]);

UniLabel12.Caption := '<a href="'+s+'" target=_blank>Descargar imagen</a>';

 

This example puts a link in a TUniLabel (TextConversion property set to txtHTML).

The files saved in the session cache folder are deleted when the session is clossed.

 

Please give me some suggestion how to download file that the server just generate after button click. I have a unidbgrid displaying the data that users selected from their desired criteria. I need to have one button for them to download this data after they click on it. This file will be generated at the server after the users click on the button. The file may be Text, XLS or whatever format (this I can do it on the server). After it was generated it should be automatically send back to user by letting them select the folder to store the file (this I need suggestion). Anyway, Thank in advance for any suggestions that may have.

Link to comment
Share on other sites

A workaround working for me (until Farshad implements the SendFile):

 

s := UniServerModule.LocalCachePath + 'imagen'+IntToStr(GetTickCount)+'.bmp';

TBlobField(Qclaus.FieldByName('imatge')).SaveToFile(s);

s := Copy(s,Pos('cache',s),255);

s := StringReplace(s,'\','/',[rfReplaceAll]);

UniLabel12.Caption := '<a href="'+s+'" target=_blank>Descargar imagen</a>';

 

This example puts a link in a TUniLabel (TextConversion property set to txtHTML).

The files saved in the session cache folder are deleted when the session is clossed.

 

 

Thank you for your suggesstion.

Link to comment
Share on other sites

Farshad, I know you have a very good great job, but if would be possible to include a thread on the forums where could appear some solutions like this one and others to a variety of problems would be great, as they would be searchable and easily accessible to us, which have less experiences. Of course it would always be with the consent of the authors. It is like a FAQ, but named FAS (S- Solutions).

Link to comment
Share on other sites

  • 6 months later...
  • 2 weeks later...

Just downloaded and compiled with

uniGUI Beta v0.88.0.941 (10.8 MB 2012-02-07)

 

Sendfile not active yet?

 

He forgot as he said in #9. Anyway I knew he had many thing to do but I still hope he will make it soon.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...