Re: Help: a NS7 problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Aug 2004 22:08:09 -0300, oleks <oleks@xxxxxxxxxxx> wrote:
> Hi All
> 
> How to fix a NS7 problem where it wants to add a .PHP extension to all
> filenames
> 
> I try to use this funnction:
> 
> function download ($fileDir, $fileName) {
>     $completeFilePath=$fileDir.'/'.$fileName;
>     header('Pragma: no-cache');
>     header("Content-type: archive/exe\n
>            Content-Disposition: attachment;
>                 filename=\"" . $fileName . "\"\n
>            Content-length: ".(string)(filesize($completeFilePath))
>           );
>     $fd=fopen($completeFilePath,'rb');
>       while(!feof($fd)) {
>           print(fread($fd, 4096));
>           flush();
>       }
> }
> 

1) don't use newlines in your headers. Send each header with its own
header() call
2) browsers are fickle when it comes to downloading files. Search
Google and the lists for more ideas

Here's what I ended up with after lots of heartache:

header('Pragma: private');
header('Content-Type: '.$resource['mimeType']);
header('Content-Disposition: inline; filename="'.$resource['fileName'].'"');
//header('Content-Length: '.strlen($resource['data']));
header('Content-Transfer-Encoding: binary');
echo $resource['data'];

I never got the content-length to work right, myself.

> MSIE6 works perfect but NS7 adds .php extension when I try to force NS7
> to download a file. How to fix this problem
> 
> Thanks for help ...
> Oleks
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> !DSPAM:411ac0d2228921094323535!
> 
> 


-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux