|
Posted by NC on 03/17/06 20:31
aljosa.mohorovic@gmail.com 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
Navigation:
[Reply to this message]
|