APKファイルのダウンロードのカウンターを増やしてから、ダウンロードのためにファイルをブラウザーに送信するスクリプトを実行しています。
これが私が持っているものです:
<?php
$file = "android.apk";
function force_download($file){
header("Pragma: public", true);
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=".basename($file));
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($file));
die(file_get_contents($file));
}
force_download($file
問題は、Firefoxのようなブラウザではダウンロードしますが、「android.apk-0バイト」のようなものです。したがって、基本的に、ファイルの内容はダウンロードされません。
私は何を間違っているのでしょうか?これに対する解決策は?
重要:モバイルで動作する必要があります。
);