title: file_get_contents(): Filename cannot be empty in line C: xampp
body: <p>I would like to point out before I get into this that I am a PHP newb, and I have been struggling for a while with this before finally deciding that I don't know what I'm doing with </p>
  
  <pre><code>function extract_bin($Filename, $output){
      global $template;
      global $BinColumnDelimiter;
      global $BinLineEnd;
  
      $decodedfile = fopen($output,'w+');
      $decodedfilecontents  = "";
  
      $handle = fopen($Filename, "r");
  
      if ($handle) {
  
          foreach ( $template as $ColName=&gt;$Endians) 
              $decodedfilecontents .= $ColName.$BinColumnDelimiter;
  
          $decodedfilecontents .= $BinLineEnd;
  
          while (!feof($handle)) {
              $lastLine = '';
  
              foreach ($template as $ColName =&gt; $Endians){
                  $hex  = bin2hex(fread($handle,$Endians));
  
                  if ( $Endians &lt;= 4) {
                      $val = hexdec(decodehex($hex));
                      if ( $val == 4294967295  ) $val = -1;
                      $lastLine .= $val.$BinColumnDelimiter;
                  } else {
                      $lastLine .= str_replace("\t"," ",hex2str($hex)).$BinColumnDelimiter;
                  }
              }
  
              if ( ! feof($handle))
                  $decodedfilecontents .= $lastLine.$BinLineEnd;
          }
  
          fclose($handle);
  
          fwrite($decodedfile,$decodedfilecontents);
          fclose($decodedfile);
    }
    echo '&lt;h1&gt;'.$output.'&lt;/h1&gt;';
    echo '&lt;hr /&gt;';
    print_r($decodedfilecontents);
  }
  </code></pre>
  
  <p>And I keep getting this error:</p>
  
  <p>Warning:  fopen(): Filename cannot be empty in C:\xampp\htdocs\rh-bin\func.php on line 8</p>
  
  <p>My questions are, what am I doing wrong in my attempt to pass on the uploaded file as an attachment? And, why does $FileName seem to be empty? Also, not everyone will be uploading files, so how could I allow the submit?</p>