Jump to content

PHP Serving a file


GunsNRoses

Recommended Posts

Hello, there. Nice site.

I'm using a php script which serves a movie file to a player embeded in an html page.

Within the script I use the following headers:

 

$fName = 'test.flv';

$fSize = filesize($fName);

header('Content-Description: File Transfer');

header ("Content-transfer-encoding: binary");

header ("Content-Type: video/flv");

header ("Content-Length: " . $fSize);

header ("Pragma: public");

header ("Expires: 0");

header ("Cache-Control: private");

readfile($fName);

                exit;

The problem is that the user can't go to another page, until the player finishes the download of the movie. Any solutions to these problems, is there a specific header which allows premature cancelation of the download? Thanks in advance. :)

Link to comment
https://forums.phpfreaks.com/topic/96915-php-serving-a-file/
Share on other sites

I mean that once the download starts, the browser acquires somekind of a lock and waits the download to finish. For example the user opens play.php, where the flash file is served, the movie starts to download in the player, during that time if a user clicks a link pointing to let's say test.php, nothing happens. The user is redirected to test.php, after the download finishes. It's like the browser ques the request headers and sends them only after the download is finished.

 

The most common method for doing what I assume you are doing is to generate a "config" file with php and add the link to the flash params.

 

Yes, thats exactly what I'm doing.

Link to comment
https://forums.phpfreaks.com/topic/96915-php-serving-a-file/#findComment-496604
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.