当前位置: 动力学知识库 > 问答 > 编程问答 >

File download php 403 Forbidden

问题描述:

We are trying to download a mp3 file, we create an iframe in the page and set its source:

my_iframe.attr('src',"dl.php?path="+mp3_path+"&name="+mp3_name);

mp3 files are set to 777 permission and are accessible, for example:

http://www.gandaldina.org/mp3/Lectures/2013-09-19_Paragraph-30.mp3

dl.php file has this contest:

<?php

header("Content-Type: application/octet-stream");

if(isset($_GET['name'])){

$name = $_GET['name'];

header("Content-Disposition: attachment; filename=\"$name\"");

}

if(isset($_GET['path'])){

$path = str_replace(' ', '%20', $_GET['path']);

readfile($path);

}

exit;

?>

Go to this link and click download icons in the audio player, you will get 403 error in console.

http://gandaldina.org/en/lectures-%D8%A7%D9%84%D9%85%D8%AD%D8%A7%D8%B6%D8%B1%D8%A7%D8%AA/

Can anybody help solving this error?

分享给朋友:
您可能感兴趣的文章:
随机阅读: