|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Iam storing some of my pdf files in MySql database.But when i pull the files to show up in browser iam not getting a pdf file, i just get the binary on my browser to show up.
IS there are any alternate way that i can handle this problem? |
|
#2
|
|||
|
|||
|
what is your column type?
|
|
#3
|
|||
|
|||
|
columntype is blob
|
|
#4
|
||||
|
||||
|
You need to set the "content-type" header of the page before streaming the binary to it.
PDF's content type is: application/pdf The actual code to set it is different for each language (which you did not metion) |
|
#5
|
|||
|
|||
|
This is thecode iam using for pulling those pdfs from MySql database and show it in browser
<cfquery name="pullpdfqry" datasource="TOD"> SELECT FileName,FileData FROM Files WHERE ID = 54 </cfquery> <cfcontent type="application/pdf" file="#pullpdfqry.FileData#" deletefile="yes" > I get an error msg saying bytearray objects cannot be converted to strings. |
|
#6
|
||||
|
||||
|
Why don't you just store a reference to the PDFs in the database and store the PDFs in the filesystem? My understanding is that blobs are inefficient. Then all you'd need to do would be either to redirect to the PDF in question or to open it up and spit it out. I'm in favor of redirecting, though if you need to keep the files out of the web tree, you'd need to open and spit it out.
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > PDF's in MySql |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|