I have a file management system I'm building where only zip files are allowed. I dont want anyone to see where the file is stored on the server so I'm using an ajax call to a php file that executes the following:
if (!empty($find_url)) {
foreach ($find_url as $file) {
$dl = urldecode($file->file_url);
}
$file_headers = @get_headers($dl);
if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
$exists = false;
} else {
$exists = true;
header('Content-Type: application/zip');
header("Content-Transfer-Encoding: Binary");
header('Location: '.$dl);
}
}
The file downloads fine but it pumps out a console message pointing out the file location:
Resource interpreted as Document but transferred with MIME type application/octet-stream:
"http://www.exmple.co.uk/someplace/filename.zip".