Re: Automatically opening pdf files stored in a bytea field

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: Automatically opening pdf files stored in a bytea field
Дата
Msg-id 434C66E0.8060801@familyhealth.com.au
обсуждение исходный текст
Ответ на Automatically opening pdf files stored in a bytea field  (Adam Witney <awitney@sgul.ac.uk>)
Ответы Re: Automatically opening pdf files stored in a bytea field  (Volkan YAZICI <volkan.yazici@gmail.com>)
Список pgsql-php
I'm not 100% sure you need the pg_unescape_bytea - I thought that was
already done automatically?

Chris

Adam Witney wrote:
> Hi,
>
> This may be off-topic as regards the database aspect, but im sure people on
> this list must come across this problem.
>
> I have PDF files stored in a bytea field in the database and I want to all
> the user to click a link on the web page and have the file automatically
> opened in acrobat (or whatever they have set to read the pdf). It works for
> most browsers except for in Internet Explorer on windows (surprise
> surprise!). Here is my code
>
>  $sql_data = "SELECT filename, file_data FROM dba_suppl WHERE dba_suppl_id =
> ".$dba_suppl_id.";";
>
>  if($stat2 = execute($sql_data))
>     {
>      if($rows = pg_numrows($stat2))
>         {
>          $data = pg_fetch_array($stat2, 0);
>
>          header("Content-type: application/pdf");
>          header('Content-Disposition: attachment;
> filename="'.$data['filename'].'"');
>
>          echo pg_unescape_bytea($data['file_data']);
>         }
>     }
>
> If I click it it opens acrobat but acrobat gives an error. If I right click
> the link and save to disk I can open the file from there no problem. As I
> say, on my mac and on FireFox on windows it does the right thing... Its just
> IE on windows!
>
> Is there something I am forgetting to do here? Or is it just IE and there is
> no way around it??
>
> Thanks for any help
>
> Adam
>
>


В списке pgsql-php по дате отправления:

Предыдущее
От: Adam Witney
Дата:
Сообщение: Re: Automatically opening pdf files stored in a bytea
Следующее
От: Adam Witney
Дата:
Сообщение: Re: Automatically opening pdf files stored in a bytea