Website video download error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
caljuice
Forum Newbie
Posts: 3
Joined: Fri Oct 02, 2009 1:34 am

Website video download error

Post by caljuice »

So I uploaded a video onto my website. But when I go to the link it streams instead of downloading so I decided to use this php script I found:


<?php

header('Content-type: /');

header('Content-Disposition: attachment; filename="Movie.wmv"');

readfile('Movie.wmv');
?>


But when you download the video it is corrupted. But streaming it is fine. So am I missing something here? I'm guessing it's content-type but not sure how this statement works. Thanks.
lunarnet76
Forum Commoner
Posts: 67
Joined: Sun Apr 04, 2010 2:07 pm
Location: Edinburgh

Re: Website video download error

Post by lunarnet76 »

hmmm okay easy solution : do two php file, one for streaming, one with

Code: Select all

<?php
header('Content-Type: video/quicktime');
readfile('d:/1.mov');
?>
works^^
Post Reply