2014-02-26 44 views
0

我需要上傳blob文件的幫助。上傳文件blob php

我有這樣的代碼:

echo "<tr><td>File document:</td>";echo"<td>"; 
echo '<a href="download_file.php?FileDocument=' . $show['id']. '">Open file</a>'; 

我需要幫助下面的代碼。 我已經嘗試過worked.I只需從最簡單的

<?php 

include("connect.php"); 
if (isset($_GET["id"]) && ctype_digit($_GET["id"])) { 

$sql = mysql_query("Select * From tb_work where id = $id"); 

if ($sql) { 

    if (mysql_num_rows($sql)==1) { 


     $line = mysql_fetch_row($sql); 


     $file = $line['FileDocument']; 


     if ($file!='') { 


      header('Pragma: public'); 
      header('Expires: 0'); 
      header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 
      header('Content-Type: application/pdf'); 
      header('Content-Transfer-Encoding: binary'); 
      header('Content-Length: '.filesize($file)); 


      echo $file; 
      } 
     } 
    } 
    } 
    ?> 

的結果,這是空白頁

+0

你能告訴我們你到目前爲止所嘗試過的嗎? – Dan

+1

是的。會改變問題 – user3253195

回答

0

您嘗試使用$_GET["id"]但沒有id參數在您的網址代碼的各種代碼,沒有,只有FileDocument
嘗試$_GET["FileDocument"]