duanfan1869 2013-11-16 05:24
浏览 39
已采纳

在PHP中通过ODBC从Access获取二进制文件仅返回前4 KB

I am trying to use PHP (CodeIgniter) and ODBC to fetch files (image, pdf, doc) stored in an Access database and show them in a browser. Unfortunately it returns only the first 4kb of every file.

$this->load->database();
$query = $this->db->query("select  noe,file from Sanad_File
where id=$id");
$rowim=$query->result();
if($rowim[0]->noe=="pdf")
  header('Content-Type: application/pdf');
else if ($rowim[0]->noe=="jpg") 
  header('Content-Type: image/jpeg');
else if ($rowim[0]->noe=="tif") 
header('Content-Type: image/tiff');
else if ($rowim[0]->noe=="doc" || $rowim[0]->noe=="docx")   
header('Content-Type: application/msword');
echo $rowim[0]->file;

I suspect that it's an ODBC issue. Can anyone help me find the solution?

  • 写回答

1条回答 默认 最新

  • douduiwei2831 2013-11-17 12:09
    关注

    The default value for longreadlen is 4096 (ref: here). You will need to increase that value via odbc_longreadlen().

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败