fayne Posted July 2, 2013 Share Posted July 2, 2013 Hello, I have a page where users can insert pdf-document into my mssql database. The selected pdf get converted with the following lines and then inserted into a image column in my mssql database. $filename = $_FILES["pdf"]["tmp_name"]; $datastring = file_get_contents($filename; $arrdata = unpack("H*hex", $datastring); $content = "0x".$arrdata['hex']; Now on another page the user can view the pdf they inserted into the database with the following code; $query = odbc_exec($conn, "SELECT name, size, type, document FROM documents WHERE id='". $id ."'"); while (odbc_fetch_row($query)) { $filename = odbc_result($query,"name"); $filesize = odbc_result($query,"size"); $filetype = odbc_result($query,"type"); $filedata = odbc_result($query,"document "); header("Content-Length: ". $filesize .""); header("Content-Type: ". $filetype .""); header("Content-Disposition: attachment; filename=". $filename .""); echo $filedata; } This is all working perfectly with pdf files below 500kb. But once a pdf document exceeds the 500kb I get an error downloading the pdf file with the above script. And the pdf-document gets inserted right because from my vb.net tool I still can open the pdf-document from the mssql database. Is there some kind of limit in php that when a file exceeds 500kb he won't show/download it? Can someone explain me how I can adjust this so that pdf documents that are bigger then 500kb still can be opened from the php page? Quote Link to comment https://forums.phpfreaks.com/topic/279780-getting-pdf-from-mssql-error-on-some-documents/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.