Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSV File download not working on live server though it works on localhost

    I am facing a problem with the CSV download on live though it's working on localhost.

    Here is my code, please have a look -

    function event_signup_download_detail($nid)
    {
    module_load_include('inc', 'signup_event', 'event_signup_view');
    $csv_output = '';
    $csv_output .= "Role,Last name,First Name,Patrol,Position,Home phone,Cell Phone,Email,Payment Date,Unit Join Date,Payment Status\n";
    $nid = 2001;

    // add the paid users to the csv
    $csv_output .= getPaidScoutUsers($nid);

    // get unpaid users, add them to the csv
    $csv_output .= getUnpaidUsers($nid);

    header("Content-type: application/vnd.ms-excel");
    header("Content-Disposition: attachment; filename=\"Registration_Dues_Information.csv\"");
    header("Pragma: no-cache");
    header("Expires: 0");
    print $csv_output;
    exit(0);
    }

    Can somebody point out the issue?
    I have mentioned AddType application/octet-stream .csv in my .htaccess also, so that wont be the issue I hope..

    Thanks

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Check your error logs or enable it inline with
    PHP Code:
    ini_set('display_errors'1);
    error_reporting(E_ALL); 
    Any issues with undefined functions or headers already sent?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Tags for this Thread

    Posting Permissions

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