PHP only allow file to be downloaded via page -


i've got mp3 files i'd allow paying members listen , download via page. problem is, if do

order deny,allow deny allow website.com 

it stops users downloading @ www.example.com/song/song.mp3

i can this

    header('content-description: file transfer');     header('content-type: application/octet-stream');     header('content-disposition: attachment; filename='.basename($file));     header('content-transfer-encoding: binary');     header('expires: 0');     header('cache-control: must-revalidate, post-check=0, pre-check=0');     header('pragma: public');     header('content-length: ' . filesize($file));     ob_clean();     flush();     readfile($file);     exit; 

but allows users download. if have html5 player allow user stream before downloading, says "the audio not loaded, either because server or network failed or because format not supported." if cancel lines htaccess, able stream.

here's player

<video id="player" class="video-js vjs-default-skin" controls preload="auto"             data-setup="{}"> <source src="song/song.mp3" type='audio/mp3' /> </video> 

is there way can allow paying users download , stream specific page only, , restricting else? thanks


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -