【问题标题】:Upload file blob php上传文件blob php
【发布时间】:2014-03-29 15:15:02
【问题描述】:

我需要关于上传 blob 文件的帮助。

我有这个代码:

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

我需要帮助下一个代码。 我已经尝试了各种代码,但没有一个有效。我只需要最简单的代码

<?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;
          }
       }
    }
  }
  ?>

结果是空白页

【问题讨论】:

  • 你能告诉我们到目前为止你尝试了什么吗?
  • 是的。将改变问题

标签: php download blob


【解决方案1】:

您尝试使用$_GET["id"],但您的网址中没有id 参数,只有FileDocument
试试$_GET["FileDocument"]

【讨论】:

    猜你喜欢
    • 2011-12-16
    • 1970-01-01
    • 2018-12-07
    • 1970-01-01
    • 2023-03-31
    • 2018-10-27
    • 1970-01-01
    • 2014-01-23
    • 2017-03-14
    相关资源
    最近更新 更多