title: codeigniter txt file upload
body: <p>I'm using codeigniter and I found a strange case when I try to upload some text files.</p>
  
  <p>Using the method documentation indicating (<a href="http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html" rel="nofollow">CI doc</a>) everything works fine, but if I try to upload the file contains the string ' // ' (without quotes) the result I get is "The filetype you are attempting to upload is not allowed."</p>
  
  <p>Any idea?</p>
  
  <p>Code used: (controller)</p>
  
  <pre><code>function do_upload() {
      $config['upload_path'] = APPPATH.'uploads/';
      $config['allowed_types'] = 'txt|csv';
      $config['max_size'] = '1024';
      $config['max_width']  = '0';
      $config['max_height']  = '0';
      $this-&gt;load-&gt;library('upload', $config);
      @var_dump($_FILES['userfile']);   // debug
      if (!$this-&gt;upload-&gt;do_upload()) {
          $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
          $this-&gt;load-&gt;view('upload_form', $error);
      } else 
          echo "&lt;br&gt;upload ok";
  }
  </code></pre>
  
  <p>upload_form.php (view):</p>
  
  <pre><code>&lt;?php 
      if (isset($error)) echo $error;
      echo form_open_multipart('supervisor/do_upload'); 
      echo form_label('File', 'userfile');
      echo form_upload('userfile');
      echo form_submit('submit', 'Upload');
      echo form_close() 
  ?&gt;
  </code></pre>
  
  <p>For example: (.txt for upload)</p>
  
  <pre><code>[file1.txt]:
  THIS IS A TEXT FILE     # work fine
  
  [file2.txt]:
  THIS IS A // TEXT FILE    # fail!  note: {blank}//{blank}
  </code></pre>
  
  <p>output (uploading file1.txt)</p>
  
  <pre><code>array(5) { ["name"]=&gt; string(9) "file1.txt" ["type"]=&gt; string(10) "text/plain" ["tmp_name"]=&gt; string(14) "/tmp/phpLVaMGs" ["error"]=&gt; int(0) ["size"]=&gt; int(19) }
  upload ok
  </code></pre>
  
  <p>output (uploading file2.txt)</p>
  
  <pre><code>array(5) { ["name"]=&gt; string(9) "file2.txt" ["type"]=&gt; string(10) "text/plain" ["tmp_name"]=&gt; string(14) "/tmp/phpFu4znR" ["error"]=&gt; int(0) ["size"]=&gt; int(22) }
  
  The filetype you are attempting to upload is not allowed.
  ...
  </code></pre>
  
  <p>Firebug POST: (uploading file2.txt)</p>
  
  <pre><code>userfile    THIS IS A // TEXT FILE
  submit  Upload
  Fuente
  -----------------------------15028408581691128039842883428 
  Content-Disposition: form-data; name="userfile"; filename="file2.txt" 
  Content-Type: text/plain 
  THIS IS A // TEXT FILE 
  -----------------------------15028408581691128039842883428 
  Content-Disposition: form-data; name="submit" 
  Upload 
  -----------------------------15028408581691128039842883428--
  </code></pre>