Re: Download Video File and Play



Harsha wrote:
Hello Everyone,

I am a new to php programming, please help me out with the following
issue which i am unable to resolve.

I am developing a site with flv videos on it. I am using JW player to
play the videos. When a user clicks the link, i want the video file to
be downloaded completely by the client machine and after downloading,
i want the player to get handle of it and play the file.

I don't want to stream the file. I tried using readfile() function,
but the file is downloaded in traditional method and stored in the
user's machine. Its like i streaming, but i want the video to play
only after completely streaming, in a way after downloading
completely.

please help me to use the right php functions to do this.

Thanks...


The first thing to learn here is that you have absolutely no control over what the "client" uses to play or view anything. You also have no control over whether they "play" the file or "save" the file. This is by design so that trojans cannot be easily installed and executed on their "client". Unless JW player is public domain, you may have licensing issues as well. They could have RealPlayer or whatever... There is no PHP function that will give you this control.

"downloading" the file is as easy as ensuring the proper content and disposition headers are sent...

If you are downloading an excel spread***:

header("Content-Type: text/csv");
header("Content-Disposition: inline; filename=excel.csv");
header("Pragma: no-cache");
header("Expires: 0");




.