473,382 Members | 1,447 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,382 software developers and data experts.

.wmv file downloading

Dear Sir,
i am facing a problem in downloading .wmv file.
while i downloded the .wmv file and then try to open it gives an error that file type is not supported. can any one tell me where is the problem in my php code?

Expand|Select|Wrap|Line Numbers
  1.  
  2. $videoName = "new_Ayman.wmv"; 
  3. $videoDir = "download/tv-interview/"; 
  4.  
  5. $fullPath = $videoDir . $videoName; 
  6.  
  7. header("Content-Type: video/x-ms-wmv"); 
  8. header("Content-disposition: inline; filename={$videoName}"); 
  9. header("Content-length: ". filesize($fullPath)); 
  10. readfile($fullPath); 
  11. exit(); 
  12.  
  13.  
  14.  
Mar 23 '09 #1
8 3608
Markus
6,050 Expert 4TB
I don't see anything obviously wrong your code. Sounds like it's maybe your OS not reading the file correctly.
Mar 23 '09 #2
@Markus
Thanx for your quick response.

Can you tell me what will be problem at OS ?
i checked from different client's pc and all of them are using windows xp. and i am using apache 2.2.8 web server.
in all cases the same problem exist.
Mar 23 '09 #3
Markus
6,050 Expert 4TB
@farukcse
Ok, that more than likely rules out your OS.

Trying setting the mime type (content-type) as 'application/octet-stream'.
Mar 23 '09 #4
Now i am using the code like as below.But it remains same problem. the error is like that:
The file you are attempting to play has an extension that does not match the file format.



Expand|Select|Wrap|Line Numbers
  1. videoName = "new_Ayman.wmv"; 
  2. $videoDir = "download/tv-interview/"; 
  3.  
  4. $fullPath = $videoDir . $videoName; 
  5.  
  6. header("Content-Type: application/octet-stream");   
  7. header("Content-Type: video/x-ms-wmv"); 
  8. header("Content-disposition: inline; filename={$videoName}"); 
  9. header("Content-length: ". filesize($fullPath)); 
  10. readfile($fullPath); 
  11. exit();
  12.  
Mar 23 '09 #5
Markus
6,050 Expert 4TB
Sounds like the file is maybe corrupt.

Expand|Select|Wrap|Line Numbers
  1. header("Content-Type: application/octet-stream");   
  2. header("Content-disposition: inline; filename={$videoName}"); 
  3. header("Content-length: ". filesize($fullPath)); 
  4. readfile($fullPath); 
  5. exit();
Minus the second content-type header.
Mar 23 '09 #6
can you tell me what is reason file to be corrupted?
i tried the following code but it reamins same problem as before.

Expand|Select|Wrap|Line Numbers
  1.  
  2. $videoName = "new_Ayman.wmv"; 
  3. $videoDir = "download/tv-interview/"; 
  4.  
  5. $fullPath = $videoDir . $videoName; 
  6.  
  7. header("Content-Type: application/octet-stream");   
  8.  
  9. header("Content-disposition: inline; filename={$videoName}"); 
  10. header("Content-length: ". filesize($fullPath)); 
  11. readfile($fullPath); 
  12. exit(); 
  13.  
  14.  
Mar 23 '09 #7
Markus
6,050 Expert 4TB
Content-disposition may have to be 'attachment' not inline..

Does this happen with any file you try and download?
Mar 23 '09 #8
i tried with the code as below. but it remains same problem. this problem is for vedio and audio files. but it does not happend in .doc or jpg files.

[code]
$videoName = "new_Ayman";
$videoDir = "download/tv-interview/";

$fullPath = $videoDir . $videoName;

header("Content-Type: application/octet-stream");
header("Content-disposition: attachment; filename={$videoName}");
header("Content-length: ". filesize($fullPath));
readfile($fullPath);
exit();

[code]
Mar 24 '09 #9

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

Similar topics

1
by: ASP Spam Fighter | last post by:
Hello all, I don't know how to get around this one... If anybody can help me with this problem, I would appreciate it very much. I've been trying to send a (large) file to the browser via a...
2
by: Ryan Taylor | last post by:
Hello. I am trying to upload a file and save it in a Sql Server 2000 database. This seems to be working fine. However, when I download the file from SQL Server, it appears that the page that is...
2
by: Bala | last post by:
Hi I am trying to download the PDF files from my webserver using ASP.Net. All my files are stored at F Drive on webserver. Like this F:\Main Folder\Sub Folder\Files\File1.pdf I am...
1
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
3
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
2
by: Tomas Martinez | last post by:
Hi there! I'm trying to download a file in my asp.net web, but when downloading it from a Firefox browser, instead of downloading the example.exe file, it's downloading example.exe.htm. My code...
1
by: DBC User | last post by:
Hello, I would like to copy a very large file (80MB) from the web, which is the best approach for downloading such a large file and also how can I show how much percent completed to user. I...
6
by: rony_16 | last post by:
Hi, I have problem with downloading a file using WebRequest and HttpWebResponse. Inorder to download this file i need to call to url that tells to prepare the file for download, and then i call...
6
by: Michael | last post by:
I need to copy a huge file (around 300Mb) from a mapped network drive to another. I have created a console application and used System.IO.File.Copy function. But I want to know the process of...
1
ddtpmyra
by: ddtpmyra | last post by:
When Im downloading a file from mysql database the file is already corrupted below are the code I used on downloading to mysql and uploading from mysql. PDF file are doing okay as long as it is a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.