RE: [PHP] Header function

2010-02-27 Thread Nick allan
Interesting the following works
Changing the " to '. If I leave the ' around the filename, the ' becomes part 
of the filename. But it seemed to be more about changing the surrounding ' to " 
that fixed it. Not sure why this is, but its working now.


header('Content-Type: application/msword');
 header("Content-Disposition: attachment; filename=PurchaseReq.doc");
-Original Message-
From: Richard Quadling [mailto:rquadl...@googlemail.com] 
Sent: Saturday, 27 February 2010 8:45 PM
To: Nick allan
Cc: php-general@lists.php.net
Subject: Re: [PHP] Header function

On 27 February 2010 04:32, Nick allan  wrote:
> Hi all
>
> Has anyone got any ideas why the following isn't giving me correct filename
> in the ie save dialogue
>
> header('Content-Type: application/msword');
>
>  header('Content-Disposition: attachment; filename="PurchaseReq.doc"');
>
>
>
> I get the save dialogue, but with preq.doc instead of PurchaseReq.doc
>
> Preq.php is the calling php file. It has worked before so I'm not sure what
> I've changed to have it stop working.
>
>
>
>
>
> Thanks in advance for any suggestions.
>
>
>
> Regards Nick
>
>
>
>

What happens if you drop the quotes around the filename?

-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling


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



[PHP] Header function

2010-02-26 Thread Nick allan
Hi all

Has anyone got any ideas why the following isn't giving me correct filename
in the ie save dialogue

header('Content-Type: application/msword');

 header('Content-Disposition: attachment; filename="PurchaseReq.doc"');

 

I get the save dialogue, but with preq.doc instead of PurchaseReq.doc

Preq.php is the calling php file. It has worked before so I'm not sure what
I've changed to have it stop working.

 

 

Thanks in advance for any suggestions.

 

Regards Nick

 



[PHP] header function query

2010-02-25 Thread Nick allan
Hi all

The situation is as follows

I've read some data in from a couple of files into a string variable, made
some changes to it and want to send the contents of the string out to the
browser as a word document.

My code currently looks like the following

header('Content-Type: application/msword');

header('Content-Disposition: attachment;
filename="preq.doc"');

ob_clean();

echo $allText;

 

 

The above code works fine, the client gets a file download dialogue and can
save or open the file.

How can I indicate end of file, then continue writing html to display a new
page. I want to be able to ask the user some additional questions after they
have downloaded the file.  My problem is that if I add any html code after
the above echo statement, it is included in the downloaded file.

There's probably a simple answer to this, but I haven't been able to find
anything using google.

 

Thanks in advance for any suggestions.

 

Regards Nick