How hard is it, to write a PHP script to allow user to download a file? really easy, one would say. Just send the appropriate HTTP header and echo the file content.
1 2 3 4 5 |
<?php header('Content-type: application/force-download'); header('Content-Disposition: attachment; filename="test.txt"'); echo(file_get_content('/path/to/file')); ?> |
Basically that’s all I need to force download per PHP. But somehow Android stock browser (Chrome) only downloads and creates a 0 kB file. Other browser (tested with Firefox on Android) saves the file correctly.
What does happen here?