PDA

View Full Version : بازیابی فایل ذخیره شده در دیتابیس اکسس



mostafa_shaeri_tj
شنبه 25 آبان 1392, 10:58 صبح
سلام.
یک جدول در دیتابیس اکسس داریم که یکی در یکی از فیلدهاش فایل(عکس) ذخیره شده.
قصد دارم با php فایل رو از دیتابیس بازیابی کنم و نمایش بدم. این کار انجام میشه اما کد نوشته شده فقط چهار کیلوبایت اول فایل رو برمیگردونه.

اگر ممکنه راهنمایی کنید.



$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');
//$data=$rowim[0]->file[2];
// tried echoing it directly..
//file_put_contents('test.jpg', $data);
echo $rowim[0]->file;