Header function

------=_NextPart_000_0035_01CAB7C2.08555930
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

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




------=_NextPart_000_0035_01CAB7C2.08555930--
Nick Allan [ Sa, 27 Februar 2010 05:32 ] [ ID #2033596 ]

Re: Header function

On 27 February 2010 04:32, Nick allan <nallan [at] wdev.net> wrote:
> Hi all
>
> Has anyone got any ideas why the following isn't giving me correct filena=
me
> in the ie save dialogue
>
> header('Content-Type: application/msword');
>
> =C2=A0header('Content-Disposition: attachment; filename=3D"PurchaseReq.do=
c"');
>
>
>
> 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 wh=
at
> 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=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard Quadling [ Sa, 27 Februar 2010 10:44 ] [ ID #2033601 ]

RE: Header function

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=3DPurchaseReq.doc");
-----Original Message-----
From: Richard Quadling [mailto:rquadling [at] googlemail.com]
Sent: Saturday, 27 February 2010 8:45 PM
To: Nick allan
Cc: php-general [at] lists.php.net
Subject: Re: [PHP] Header function

On 27 February 2010 04:32, Nick allan <nallan [at] wdev.net> 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=3D"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=3DZEND002498&r=3D213474731
ZOPA : http://uk.zopa.com/member/RQuadling


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nick Allan [ Sa, 27 Februar 2010 13:48 ] [ ID #2033604 ]

RE: Header function

--=-uY/FVtaBoEn0zr9uragE
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sat, 2010-02-27 at 23:48 +1100, Nick allan wrote:

> 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:rquadling [at] googlemail.com]
> Sent: Saturday, 27 February 2010 8:45 PM
> To: Nick allan
> Cc: php-general [at] lists.php.net
> Subject: Re: [PHP] Header function
>
> On 27 February 2010 04:32, Nick allan <nallan [at] wdev.net> 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
>
>


The HTTP header doesn't treat quoteation marks in the same way that PHP
does. It needs double quote marks to function correctly.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-uY/FVtaBoEn0zr9uragE--
Ashley Sheridan [ Mo, 01 März 2010 07:13 ] [ ID #2033699 ]

Re: Header function

Ashley Sheridan wrote on 01/03/2010 07:13:

> The HTTP header doesn't treat quoteation marks in the same way that PHP
> does. It needs double quote marks to function correctly.

How do you mean? And do you have a link to this information?

Even if this is true, then the first Nick did should still be correct?

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

I'm using the same headers for downloads, allthough I use double qoutes
for the header function aswell:

header("Content-Disposition: attachment; filename=\"artist - title.mp3\"");

--
Kind regards
Kim Emax - masterminds.dk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Kim Madsen [ Mo, 01 März 2010 12:14 ] [ ID #2033700 ]

Re: Header function

--=-jKAFEyM5IvbL/DYzdkxw
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Mon, 2010-03-01 at 12:14 +0100, Kim Madsen wrote:

> Ashley Sheridan wrote on 01/03/2010 07:13:
>
> > The HTTP header doesn't treat quoteation marks in the same way that PHP
> > does. It needs double quote marks to function correctly.
>
> How do you mean? And do you have a link to this information?
>
> Even if this is true, then the first Nick did should still be correct?
>
> header('Content-Disposition: attachment; filename="PurchaseReq.doc"');
>
> I'm using the same headers for downloads, allthough I use double qoutes
> for the header function aswell:
>
> header("Content-Disposition: attachment; filename=\"artist - title.mp3\"");
>
> --
> Kind regards
> Kim Emax - masterminds.dk
>


I only meant for the quotes around the filename. I'd tried

header("Content-Disposition: attachment; filename='artist -
title.mp3'");

before and it didn't work correctly. I hadn't run into the problem of
double quotes inside singe though, as the filenames I was generating
relied on a variable, and I found it easier to just escape the second
set of nested quotes and include the variable directly.

As far as I'm aware, the header() function shouldn't care whether it
uses single or double quotes, so I would assume it's something else
amiss.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-jKAFEyM5IvbL/DYzdkxw--
Ashley Sheridan [ Mo, 01 März 2010 12:15 ] [ ID #2033702 ]
PHP » gmane.comp.php.general » Header function

Vorheriges Thema: Custom php extension
Nächstes Thema: mysqli_connect problem