title: TCPDF ERROR: Unable to create output file
body: <p>I'm trying to generate pdf with the combination of TCPDF and FPDI. Here is my code.</p>
  
  <pre><code>require_once('../tcpdf/tcpdf.php');
  require_once('../FPDI/fpdi.php');
  
  $fileName = '../sample.pdf';
  
  class PDF extends FPDI {
  /**
   * "Remembers" the template id of the imported page
   */
  var $_tplIdx;
  var $numPages = 0;
  
  /**
   * Draw an imported PDF logo on every page
   */
  function Header() {
  
      global $fileName;
  
      if (is_null($this-&gt;_tplIdx)) {
          $this-&gt;setSourceFile($fileName);
          $this-&gt;_tplIdx = $this-&gt;importPage(1);
          $this-&gt;numPages = $this-&gt;setSourceFile($fileName);
      }
      $size = $this-&gt;useTemplate($this-&gt;_tplIdx);
  }
  
  function Footer() {
      // emtpy method body
  }
  }
  
  // initiate PDF
  $pdf = new PDF($fileName);
  $pdf-&gt;setFontSubsetting(true);
  
  // add a page
  $pdf-&gt;AddPage();
  
  // save file
  $pdf-&gt;Output('output.pdf', 'F');
  </code></pre>
  
  <p>Here, the last line <code>$pdf-&gt;Output('output.pdf', 'F');</code> is for saving the file. But it is not working. When I was having only <code>$pdf-&gt;Output()</code>, it was showing the pdf in browser. </p>
  
  <p>I've tried <code>$pdf-&gt;Output('output.pdf', 'D');</code> for downloading and it worked fine. Seems <code>$pdf-&gt;Output('output.pdf', 'F');</code> is only not working and it shown an error <code>TCPDF ERROR: Unable to create output file: output.pdf</code>. </p>
  
  <p>Note: there is no file permission issues</p>
  
  <p>Can anyone point out the issue please.</p>