I am having trouble with my download function. I cannot reproduce the problem on any of my machines at home (WinXP, Mac OSX, Fedora11), but several people have written me and told me that whenever they try to download, it stops around 50%. Recently I've had people tell me that it stops at random places during the download. Reports have come in for Windows and Macs, Firefox, Internet Explorer, and Chrome. It doesn't seem specific to an operating system or browser. I have been able to reproduce this last issue on one of the Windows 7 machines on Firefox and Internet Explorer at my place of employment.
When I try to save the file, it will "complete" after a megabyte or less of data has been transferred.
When a user clicks on the "Download" link, it goes to a page called downloadShow.php. Here is my php code:
Code: Select all
<?php
$showName = $_GET['show'];
header("Content-type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
header("Content-length: ".filesize($showName));
header("Content-disposition: attachment; filename=\"$showName\"");
readfile($showName);
?>I really have no idea and I can't seem to find any useful information on the web and all of my other friends who know php far better than me haven't done anything like this.
When I started doing research on how to force a save dialog to come up, I saw many conflicting opinions on to do it and people blasting each other about using octet-stream or any other type. Unless there is no other choice (which I doubt), I do not want to have an html link and rely on the user to right-click save on their own. It's much nicer (IMO) to click on the link and bring up a dialog. My site. My design.
Can any please help me? This has been driving crazy for quite a while.
Thanks!
-tony