title: Saving generated pdf directly to a folder folder - Codeigniter
body: <p>I would like to generate and send the created pdf to a folder but i get an error, this error :</p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Warning
  
  Message: file_put_contents(http://localhost/NQCL1/workbooks/NDQA000000001/NDQA000000001.pdf) [function.file-put-contents]: failed to open stream: HTTP wrapper does not support writeable connections
  
  Filename: libraries/Dompdf_lib.php
  
  Line Number: 13
  </code></pre>
  
  <p>Dompdf_lib.php //library file</p>
  
  <pre><code>class Dompdf_lib extends Dompdf{
  
          function createPDF($html, $filename='', $stream=TRUE){  
              $this-&gt;load_html($html);
              $this-&gt;render();
              $this-&gt;set_paper('a4', 'potratit');
              if ($stream) {
                  //$this-&gt;stream($filename.".pdf"); - This works just ok
                  file_put_contents(base_url().'workbooks/s'.$filename.'/'.$filename.".pdf", $this-&gt;output()); 
  
              } else {
                  return $this-&gt;output();
              }
          }
  
  }
  </code></pre>
  
  <p>coa.php //controller</p>
  
  <pre><code>function generateCoaDraft($labref,$offset=0) {
      // error_reporting(1);
      $data['labref'] = $labref = $this-&gt;uri-&gt;segment(3);
      $data['information'] = $this-&gt;getRequestInformation($labref);
      $data['tests_requested'] = $this-&gt;getRequestedTests($labref);
      $data['trd'] = $this-&gt;getRequestedTestsDisplay2($labref);
      $data['compedia_specification'] = $this-&gt;getCOABody($labref);
     $html = $this-&gt;load-&gt;view('coa_v', $data, true);
     $this-&gt;dompdf_lib-&gt;createPDF($html, $labref);
  }
  </code></pre>
  
  <p>This line works fine if i use it instead of file_put...., if i say STREAM=FALSE, it return blank page</p>
  
  <pre><code>$this-&gt;stream($filename.".pdf"); 
  </code></pre>