Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
File::download issues.
  • Hi, I'm trying to export data from db into a csv file and also download it. The csv file is generated and stored correctly on the server, however, when I use File::download($filename), the file is downloaded but with the following warning in it: Warning!
    ErrorException [ Warning ]: Cannot modify header information - headers already sent by (output started at D:\webserver\UniServer\www\quizz\fuel\core\classes\file.php:777)
    COREPATH/classes/cookie.php @ line 95:
    94: 
    95: return setcookie($name, $value, $expiration, $path, $domain, $secure, $http_only);
    96: }
    
    My code is as follows:
      $quizzes = Format::forge($export) -> to_csv();
      
      $file_path = DOCROOT.'documents'.DS;
      $filename = time().'_export.csv';
      
      File::create($file_path, $filename, $quizzes);
      File::download($file_path.$filename);
    

    Any help is appreciated. Thanks.
  • This is a known bug that has been fixed in 1.3/develop.
  • Is there a chance to fix this without having to rely on 1.3? I need to finish the project tomorrow :S Maybe I should try the basic version, maybe I get lucky.
  • You might be succesful by cherry picking the modified classes from the 1.3 branch and copy them into your core, but I suggest you make a backup first. You need
    - Event
    - Event_Instance
    - File
  • Thanks a lot Harro, it worked!
  • Cool! Thanks for the feedback.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion