Re: file download through php
- From: "NC" <nc@xxxxxxxxx>
- Date: 17 Mar 2006 10:31:40 -0800
aljosa.mohorovic@xxxxxxxxx wrote:
I have a problem when doing indirect download of file through php, when
I click on download link Firefox and Internet Explorer give me same
options: Open and Save. Firefox opens file directly from Internet and
downloads without problem.
Internet Explorer saves file on local disk and I can open it from disk
correctly but when I try to open it directly from Internet it responds
with "There was an error opening this document. This file cannot be
found.", concrete situation in my usage is Pdf document. Below is my
concrete code, any suggestions are appreciated.
OK, I can see several possible issues here:
header('Content-Disposition: attachment');
I think you're supposed to specify a file name here:
header("Content-Disposition: attachment;
filename=[file_name_goes_here]");
header('Accept-Charset: UTF-8');
I am not sure "Accept-Charset:" header is appropriate when serving
binary files... Comment this line out and see what happens...
header('Content-Type: '.$f->get('type').'; charset="UTF-8";');
I am not sure that "charset" field is appropriate within
"Content-Type:" header when the content type it not "text/*". In any
case, there should be no semicolon at the end of a header... Try
changing it to this:
header('Content-Type: ' . $f->get('type'));
Cheers,
NC
.
- Follow-Ups:
- Re: file download through php
- From: John Dunlop
- Re: file download through php
- References:
- file download through php
- From: aljosa.mohorovic@xxxxxxxxx
- file download through php
- Prev by Date: Re: Open a https url on a special port ? (asp/ajax inside)
- Next by Date: What is the difference between raw cmd execute on server, and executing by Apache/PHP
- Previous by thread: file download through php
- Next by thread: Re: file download through php
- Index(es):
Relevant Pages
|