In my browser i can download all formats, zip, kml, pdfs, But when i try from a iphone or ipad it will work for the zips and kmls but not for the pdf. Can someone please point out what I've done incorrectly? the code I'm using is:
<?php
$file = "/raid0/data/naswebsite/Projects/Projects/" . $_GET["file"];
$parts = explode('/', $file);
$download = $parts[count($parts) - 1];
if (!file_exists($file))
{
echo "The file $file does not exist on the server.";
exit;
}
if (strpos(strtolower($file), ".zip"))
{
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' .urlencode($download));
header('Content-Transfer-Encoding: binary');
}
else if (strpos(strtolower($file), ".pdf"))
{
header('Content-Type: application/vnd.adobe.pdf');
header('Content-Disposition: attachment; filename=' .urlencode($download));
header('Content-Transfer-Encoding: binary');
}
else if (strpos(strtolower($file), ".kml"))
{
header('Content-Type: application/vnd.google-earth.kml+xml');
header('Content-Disposition: attachment; filename=' .urlencode($download));
header('Content-Transfer-Encoding: binary');
}
else
{
header('Content-Type: application/text');
header('Content-Disposition: attachment; filename=' .urlencode($download));
header('Content-Transfer-Encoding: binary');
}
readfile($file);
?>
I will also like to note I've tried using
header('Content-Type: application/pdf');
that also didn't work on the apple devices.
help appreciated.