You are here: Re: How to download MP3 and not play « HTML « IT news, forums, messages
Re: How to download MP3 and not play

Posted by Bone Ur on 11/18/07 07:40

Well bust mah britches and call me cheeky, on Sat, 17 Nov 2007 19:26:50
GMT J.O. Aho scribed:

>> This would be a server side script - like cgi?
>> or client side - like javascript?
>
> It has to be server side like php or any other scripting language.
>
> <?PHP
> $file="themp3file.mp3";
> header('Content-type: application/octet-stream');
> header('Content-Length: '. filesize($file));
> header("Content-Disposition: attachment; filename='{$file}'");
> readfile($file);
> ?>

The above code you posted was unfamiliar to me and looked interesting so I
tried it out using a .gif file instead of an .mp3, and voila!, it worked
except that I had to delete the single quotes from the Disposition line (-
and, following, deleted the then-superfluous curly braces) to avoid
receiving them in the open/save-to file name. Does this not happen to you
or am I missing something. Anyway, very clever.

--
Bone Ur (aka Neredbojias)
Cavemen have formidable pheromones.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация