473,387 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

downloaded flv file is not playing

I downloaded a flv vedio file from server using php successfully, but when I tried to play the same downloaded file it was not playing..

Also when I checked its time for which it being played in a player it showed me zero sec.

What might be the problem?

I want know how to sort out that problem,the same code is working for mp3 file without any error.

Here is my code:
Expand|Select|Wrap|Line Numbers
  1. if(isset($_GET['id']))
  2.  {
  3.   echo $sql = "select * from file_details where file_id='".$_GET['id']."'";
  4.  
  5.   $rsl = mysql_query($sql) or die("Error! query failed");
  6.   echo $name = stripslashes(mysql_result($rsl,0,'file_name'));
  7.   echo $type = stripslashes(mysql_result($rsl,0,'file_type'));
  8.   echo $path = stripslashes(mysql_result($rsl,0,'file_path'));
  9.   echo $size = mysql_result($rsl,0,'file_size');
  10.    header("Pragma: public");
  11.     header("Expires: 0");
  12.     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  13.     header("Cache-Control: private",false); 
  14.     header("Content-Description: File Transfer");
  15.     header("Content-Type: $type");
  16.  
  17.     header("Content-Disposition: attachment; filename=\"".$name."\";");
  18.     header("Content-Transfer-Encoding: binary");
  19.     header("Content-Length: ".$size);
  20.     @readfile($path);
  21.     exit;
  22.  }
could you please let me know what would i have to change so that the .flv vedio play too.

thank you
May 4 '10 #1
10 1507
Dormilich
8,658 Expert Mod 8TB
a corrupt file? incomplete download?
May 4 '10 #2
Markus
6,050 Expert 4TB
We can only make guesses without seeing the PHP code.
May 4 '10 #3
Dormilich
8,658 Expert Mod 8TB
remove the @ in line 20 (that prevents you from receiving errors)

you must send the headers before any other output (should give you plenty of warnings otherwise), not afterwards.
May 4 '10 #4
thanks
but its still not working,when I download the file its size after being download is 10.9 mb,same as the original one but in player it still shows 00:00 second while trying to play it after being downloaded.
and it does show me any warning or error massages.
May 4 '10 #5
Dormilich
8,658 Expert Mod 8TB
don’t echo the headers, this will render the file invalid.

read also the user notes on the manual page of readfile().
May 4 '10 #6
Markus
6,050 Expert 4TB
Also, remove that @ from line 20. It may be suppressing an error.

Edit: sorry - didn't see that you'd already suggested that, Dorm.
May 4 '10 #7
@Dormilich
Thank you
Dormilich and Markus you to .

Now I can download a vedio files as well as can play too by following your instruction.

The problem was the same as you told me and that is i echoed some data before calling headers.

Great reply

Thank you one more time
May 5 '10 #8
Markus
6,050 Expert 4TB
Glad you got it working, Dinesh.

For future reference, you should always develop a script with full error reporting by the PHP engine.

To do that, either set your php.ini configuration setting for error_reporting to -1, or put this at the top of your script: error_reporting(-1);.

Mark.
May 5 '10 #9
But Where is the Solution..? I have the same issue.. Please provide me a better solution for this..
Apr 12 '11 #10
Markus
6,050 Expert 4TB
The solution was to remove all output sent before calls to header().
Apr 13 '11 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Joshua | last post by:
Is there a way to set up Apache to invoke a PHP equest when a file (a image for example) is downloaded? Say, then, that http://www.foo.com/downloads/app1.zip is downloaded, Id like to have...
4
by: Brian Basquille | last post by:
Hello all, What is the syntax for simply playing a WAV file in your program? Am learning VB and have two VB books but don't wanna root through them to find the code. Any help would be much...
0
by: Chad | last post by:
I have COM component embedded on html page. It has version 1.0.0.1 (by default). I have converted it in cab file. Code of html is something like: <HTML><HEAD></HEAD><BODY><OBJECT...
1
by: Peter Schmitz | last post by:
Hi, I'm just trying to play a *.wav file, making use of the unmanaged function "sndPlaySoundA" in winmm.dll, but I still got one question: How can I avoid, that the sound file itself has to be...
1
by: Ruskin | last post by:
I have a wee issue, where I have two different web sites; http://dev/home.htm http://live/home.htm On both sites, there is a custom OCX file being used. However, it may be a different version...
2
by: Dave | last post by:
Hi, I am writing a c# application that using a directshow to play file and display it on my C# gui, its work just fine but when i try to open another thread in my c# application the file stop...
0
by: ProJee | last post by:
Hi, Response.WriteFile (or Response.OutputStream.Write) finishes immediately, not after the file is completely downloaded. It finishes before (!) the user clicks the "Save" or "Open" browser...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
0
by: tom | last post by:
Hallo, I need help on MIDI file, and precisely about retrieving few note values (mainly the "Velocity" value, corrisponding to the intensity of a played note) while the MIDI is playing.
30
by: Dave -Turner | last post by:
So I just downloaded Bloodshed devcpp, opened up the Hello example, compiled it, no problems ..... well, except one - the exe is 474,990 bytes! What's the secret to compiling small exes? Thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.