title: How to debug browser hang during upload
body: <p>I am writing a simple file uploader in CodeIgniter 2.0.2. Pasting code below.
  Under <em>certain conditions</em> the browser hangs during this upload and I get "waiting for localhost" in the browser status bar (identical behavior in FF and Chrome).
  I have verified that the file is being uploaded to the Windows temporary folder (the complete file), but the process gets stuck after that.
  It appears that the condition for the bug is file size. But my php.ini has all the right settings for uploading files, and I still get the hang with a 700k file.
  This bug occurs only when I run it on Windows 7 Apache, not on an Ubuntu box.
  The suggested to me that some paths in the php.ini may be incorrectly set.
  Apache log files have not been much help here because there is no error thrown.
  I have tried using Chrome developer panel to debug but haven't turned up anything useful.
  I am currently trying to get XDebug working, but since no error is thrown and the process doesn't complete, my expectations are low. 
  Any suggestions for how to trace this bug?
  If there are specific php.ini settings you'd like to see, let me know, don't want to do the big dump.</p>
  
  <p>Controller:</p>
  
  <pre><code>function do_upload_sql(){
      // create directory
      if (! is_dir(BACKUP_DIR)) {
          mkdir(BACKUP_DIR, 0777);
      }
      // or if it exists and has restricted file permissions, change them
      elseif(fileperms(BACKUP_DIR)!=0777){
          chmod(BACKUP_DIR, 0777);
      }
  
      $config['upload_path'] = BACKUP_DIR;
      $config['allowed_types'] = 'backup'; // an SQL backup file type
      $config['overwrite'] = TRUE;
      $this-&gt;load-&gt;library('upload', $config);
      if ( ! $this-&gt;upload-&gt;do_upload()) // this is the native CI function, probably where the problem is. I can provide some of that code if anyone wants.
      {
          $data['action'] = 'c_backup_restore/do_upload_sql';
          $tab_error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
          $data['error'] = $tab_error['error'];
          $this-&gt;load-&gt;view('common/header');
          $this-&gt;load-&gt;view('v_upload_sql', $data);
      }
      else
      {
          echo "success"; // yes it's getting here, but i get no file!
          $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
          $file_upload = $data["upload_data"];
          $this-&gt;restore_backup($file_upload); // go do something useful with the file
      }
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;p&gt;Select the backup file&lt;/p&gt;
  &lt;div class="not_success"&gt;&lt;?php echo $error;?&gt;&lt;/div&gt;
  &lt;?php echo form_open_multipart($action);?&gt;
  &lt;input type="file" name="userfile" size="30" /&gt;
  &lt;input type="submit" value="Upload" /&gt;
  &lt;/form&gt;
  </code></pre>