www.webdeveloper.com
Results 1 to 2 of 2

Thread: PHP header(Content-Disposition....) Help

  1. #1
    Join Date
    Feb 2007
    Posts
    31

    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?

    PHP Code:
    $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"); 
    Thanks

  2. #2
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,742
    Use curly syntax or concatenation. Either:
    PHP Code:
    header("content-disposition: attachment;filename=filename_{$strDate}.xls"); 
    Or:
    PHP Code:
    header("content-disposition: attachment;filename=filename_".$strDate.".xls"); 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles