Download database file via php

Asked

Viewed 89 times

0

I have a system that I didn’t create, the bank runs on sybase driver-like odbc, the php accesses everything with odbc, I need to download Pdfs that are recorded in this database in the type file column long binary. I make the following query in the bank plus what returns and the encrypted text: inserir a descrição da imagem aqui

$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 done with header plus the file only returns corrupted.

You know another way I can try because I searched everywhere and I couldn’t find.

1 answer

0

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.