Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download a served .zip file from inappbrowser through headers #615

Closed
3 tasks done
lorenzo80 opened this issue Jan 22, 2020 · 1 comment
Closed
3 tasks done

Download a served .zip file from inappbrowser through headers #615

lorenzo80 opened this issue Jan 22, 2020 · 1 comment

Comments

@lorenzo80
Copy link

lorenzo80 commented Jan 22, 2020

Bug Report

I've been trying for a couple of days to solve this issue but nothing so far.

Nothing happens when a "Download" button gets pressed.
No error, no message, just nothing at all.

The action is called by an input:

<input type="submit" name="cmdfiledownload" id="cmdfiledownload" class="button" >

A validator checks if the file has already been generated, and in case creates it before sending it back:

// Process download
if(is_file($filepath)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="'.basename($filepath).'"');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($filepath));
    ob_clean();
    flush(); // Flush system output buffer
    readfile($filepath);
    exit;
}

So, there is never a file URL exposed anywhere on the page.
Its location is NOT into public_html so it can't be reached otherwise.

The system works perfectly in a normal browser (Chrome mobile, AdBlock Beta).
I just can't make it work into inappbrowser.
Uploads work without issues.

Problem

No file gets downloaded after clicking the button

What is expected to happen?

The file gets downloaded.

What does actually happen?

Nothing at all.

Environment, Platform, Device

Android; the website is in PHP with bootstrap 4 and jquery

Version information

Cordova 9.0.0 (cordova-lib@9.0.1)
Other Frameworks: none
Windows 7 x64, CLI (Android Studio only for SDK Manager)

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@jcesarmobile
Copy link
Member

It’s already reported #311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants