We need to be able to redirect the user after the download of the file. At the end of the download code in uc_files.page.inc, a drupal_goto has been (effectively) commented out and a drupal_goto redirect does not work.
Additionally, no page refresh occurs after the download and so no drupal set message are shown user and no updates to file download counts are updated. To see drupal set messages, the user has to manually do a page refresh or bring up another web page and the drupal messages are then shown.
Has anyone been able to fix this problem so that a redirect can occur to a target webpage after the download is complete. The problem is that the headers are set for the download file to occur. Is there a way to close off those headers for the download and re-establish headers for a webpage?
I have not found a solution after much searching and found #675244: uc_file.pages.inc - cannot modify header information, but that has been closed without resolving the issue of the drupal_goto not working.
TR, you mentioned a work around or possible fix?
I think it would be great if, when a download is initiated by the user, that a progress bar could be displayed and destination webpages could be defined to take the user to upon success or errors.
Comments
Comment #1
longwaveThis is surely a restriction in the browser; you just can't send a file followed by a redirect header.
I think a possible workaround would be to send the redirect first, then on the page that is redirected to, use a meta refresh to download the actual file; but as far as I can see there is no way of determining success or failure and redirecting after the download on that basis.
Have you seen any existing site anywhere that works like this? If this is possible, inspecting such a site with Firebug or a similar tool would give you a clue as to how it's done.
Comment #2
longwaveI just don't think it's possible to send a file to the browser, and immediately send any kind of redirect afterwards. If someone can prove me wrong, please reopen this issue with an example!