File download via bank via php

0

I have a system I did not create, the bank runs in sybase with driver odbc , php access everything with odbc , I need to download PDFs that are stored in this database in the file column of type long binary . I make the following query in the bank plus what returns me and the encrypted text:

$result=odbc_exec($connect,$sql);$conteudo=odbc_result($result,"arquivo");
header("Content-Type: application/pdf; name='teste'" ); 
header("Pragma: no-cache");
echo $conteudo;

I've already done with header plus the file only returns corrupted.

You know another way you can try because I tried everything and I did not find it.

    
asked by anonymous 18.05.2017 / 21:01

1 answer

0

In my case as Xampp use it by default limits the amount of data of the query, then in file php.ini in line odbc.defaultlrl = 4092 changed its value to 10mb corresponding to 10485760 bytes. After doing the test again with the header header("Content-Type: application/pdf" ); the pdf was displayed normal.

    
19.05.2017 / 14:09