tags:

views:

46

answers:

1

I have a simple PHP page for downloading files that contains this code.

header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $name . '"');
readfile("$file");

This downloads the current bit of music I am listening to in a simple flash player.

For some reason in the latest Safari 4.0 When the download code is executed it interrupts the loading of the song to the flash player.

Basically it makes the flash player act as if it has reached the end of the file and loaded it all.

Any ideas?

A: 

Kinda hacky, but you could embed a hidden iframe on the page and make the download link use that (href="download.php?filename=something" target="iframe_name"). Like I said, a bit lame, but it (theoretically) would do the trick since you're not redirecting the page technically.

Ian Selby
I do have a hidden iframe that I use for other things and I was thinking of trying that. Any idea why Safari does this and not other browsers?
ian
honestly, I don't... I can only speculate that it has to do with the way webkit deals with page redirects (perhaps cuts all active connections before resolving the new location?)
Ian Selby