Downloading an image file

I'm trying to provide users with the ability to download an image file (jpg) of an TIWCGJQImage that is shown on screen. If I try to do it all in one button click, I find that the download does not work (Chrome seems to buffer it until I do another download later). I am using the following two methods
IWCGJQImage1->SaveImage(downloadFileName);
IWCGJQFileDownload1->DownloadFileName(downloadFileName);
I assume that I need to wait until the image is saved to the server before the download will succeed. If I split these two methods into separate buttons, then I can save the image file to the server and then download it into the browser.
Is there a way to do this all in one button click?
Thanks,
Richard
IWCGJQImage1->SaveImage(downloadFileName);
IWCGJQFileDownload1->DownloadFileName(downloadFileName);
I assume that I need to wait until the image is saved to the server before the download will succeed. If I split these two methods into separate buttons, then I can save the image file to the server and then download it into the browser.
Is there a way to do this all in one button click?
Thanks,
Richard