I am currently working on a CMS and I want the users to download .xls and .csv files through php. I tried literally everything I found to implement it, but everytime it was displayed in the html instead of downloading, and it happens when I try to download a simple .txt file too, so basically for every file download. I tried the readfile() method and PHPExcel's save('php://output'); command but none of them downloaded the file. I wonder if I should look for the bug not in my code but somewhere else (.htaccess, apache settings maybe?). Thanks in advance for your help :) 
            Asked
            
        
        
            Active
            
        
            Viewed 64 times
        
    0
            
            
         
    
    
        Luca Sara Czudar
        
- 73
- 11
- 
                    Issue proper headers for the content type before printing the output – Hanky Panky Jun 02 '16 at 08:39
- 
                    1http://stackoverflow.com/a/30116201/4007002 – Viktor Koncsek Jun 02 '16 at 08:39
- 
                    Add proper content types. – Nehal Jun 02 '16 at 08:40