/    Sign up×
Community /Pin to ProfileBookmark

PHP header(Content-Disposition….) Help

Hi everyone,

This code is works good on my test server, but when I moved it to my production server it doesn’t like how I placed the PHP var within the filename.. If I take out the var and just have filename.xls it works fine..

Any ideas?

[code=php]$strDate = $_REQUEST[“date”];
header(“Content-Type: application/vnd.ms-excel”);
header(“Expires: 0”);
header(“Cache-Control: must-revalidate, post-check=0, pre-check=0”);
header(“content-disposition: attachment;filename=filename_$strDate.xls”);[/code]

Thanks

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@bokehApr 24.2007 — Use curly syntax or concatenation. Either:[code=php]header("content-disposition: attachment;filename=filename_{$strDate}.xls"); [/code]Or:[code=php]header("content-disposition: attachment;filename=filename_".$strDate.".xls"); [/code]
×

Success!

Help @mattv10 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.13,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...