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: - if(isset($_GET['id']))
-
{
-
echo $sql = "select * from file_details where file_id='".$_GET['id']."'";
-
-
$rsl = mysql_query($sql) or die("Error! query failed");
-
echo $name = stripslashes(mysql_result($rsl,0,'file_name'));
-
echo $type = stripslashes(mysql_result($rsl,0,'file_type'));
-
echo $path = stripslashes(mysql_result($rsl,0,'file_path'));
-
echo $size = mysql_result($rsl,0,'file_size');
-
header("Pragma: public");
-
header("Expires: 0");
-
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
-
header("Cache-Control: private",false);
-
header("Content-Description: File Transfer");
-
header("Content-Type: $type");
-
-
header("Content-Disposition: attachment; filename=\"".$name."\";");
-
header("Content-Transfer-Encoding: binary");
-
header("Content-Length: ".$size);
-
@readfile($path);
-
exit;
-
}
could you please let me know what would i have to change so that the .flv vedio play too.
thank you
10 1507
a corrupt file? incomplete download?
We can only make guesses without seeing the PHP code.
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.
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.
don’t echo the headers, this will render the file invalid.
read also the user notes on the manual page of readfile().
Also, remove that @ from line 20. It may be suppressing an error.
Edit: sorry - didn't see that you'd already suggested that, Dorm.
@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
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.
But Where is the Solution..? I have the same issue.. Please provide me a better solution for this..
The solution was to remove all output sent before calls to header().
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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.
|
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
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
| |