title: jQuery File Upload - blueimp filenames with special characters
body: <p>Some of my users will attach files with names that contain special characters which are problematic for the utility when downloading and uploading, single quotes, spaces, etc. This seems like it should be a simple problem to address but since I'm a "greenie" when coding I could use some help.</p>
  
  <p>I've tried modifying the 'UploadHandler.php' functions to manipulate the file name with no success. I'm not sure if I need to address it at the input level on the form or on the upload...</p>
  
  <p>My last attempt was in the trim_file_name() function:</p>
  
  <pre><code>protected function trim_file_name($name,
          $type = null, $index = null, $content_range = null) {
      // Remove path information and dots around the filename, to prevent uploading
      // into different directories or replacing hidden system files.
      // Also remove control characters and spaces (\x00..\x20) around the filename:
      $name = trim(basename(stripslashes($name)), ".\x00..\x20");
      // Use a timestamp for empty filenames:
      if (!$name) {
          $name = str_replace('.', '-', microtime(true));
          $name = preg_replace('/[^A-Za-z0-9\-]/', '', $name); &lt;==== my attempt
      }
      // Add missing file extension for known image types:
      if (strpos($name, '.') === false &amp;&amp;
          preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
          $name .= '.'.$matches[1];
      }
      return $name;
  }
  </code></pre>
  
  <p>I could really use some help with this. I'm really frustrated.</p>
  
  <p>Thanks,</p>