I made a website you can see it at samuelt1.me. the point is that you can upload a file, then download a file from another source with the URL. the problem is it cant download to android consitently. i so far IOS is working just fine.
i used ADB like this
adb logcat DownloadManager:I *:S
i got this problem:
I/DownloadManager( 9250): Initiating request for download id = 2011 with
mAllowedNetworkTypes = -1 forP2Pbit = 8194 W/DownloadManager( 9250):
Aborting request for download 2011: http error 403,
mContinuingDownload: false FinalStatus = 403
i think it has something to do with my server but my server works just fine with every other device. so im not sure why it is breaking. Another symptom is it works on the first try usually, but on the second or third download it will fail. Here is the complete download code
include 'db.php';
include 'lib.php';
$id = preg_replace("/[^A-Za-z0-9 ()' -]/", '', optional_param('i', ''));
$query = "SELECT name, type, size, content " .
"FROM upload WHERE callId = '$id'";
$result = mysqli_query($mysqli, $query) or die('Error, query failed');
list($name, $type, $size, $content) = mysqli_fetch_array($result);
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$name");
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
echo $content;
the preg replace is just sanitizing the inputs.
i have tried nearly EVERY combination of headers, so i dont think that is the issue here.