从xampp表中的特定位置下载文件

时间:2013-04-09 21:37:38

标签: php xampp

你好,我是php和Xampp的新手我想从我在表中创建的位置下载文件我已经使用过这段代码,但是下载的文件不正确

<?php

require_once 'core/init.php';
?>
<?php

$query = "SELECT `id`, `feedback` FROM `task` WHERE `emp_id`=$empID AND `status`=1";
$result = mysql_query($query) or die('there is no tasks for you');
$row = mysql_fetch_assoc($result);

$file_name = $row["id"];
$file_path = $row["feedback"];

if (!empty($file_path)) {


    header("Content-Type: application/unknown");
    header("Content-Disposition: filename=$file_name");


    if($fp = fopen($file_path, "r")) {
        while(!feof($fp)) {
            echo  fgets($fp, 4096);
        }

        fclose($fp);
    }


}else{
    echo 'There is no Feedback now';
}

?>

0 个答案:

没有答案
相关问题