title: Ruby on Rails: restrict file type with Paperclip using a flash uploader
body: <p>I have a pretty basic Paperclip Upload model that is attached to a User model through has_many, and am using Uploadify to do the actual uploading.  Flash sends all files with the content type of "application/octet-stream" so using validates_attachment_content_type rejects all files.  </p>
  
  <p>In my create action, I am able to get the mime-type from the original file name, but only after it's been saved, with:</p>
  
  <pre>
  def coerce(params)
    h = Hash.new 
    h[:upload] = Hash.new 
    h[:upload][:attachment].content_type = MIME::Types.type_for(h[:upload][:attachment].original_filename).to_s
    ...
  end
  </pre>  
  
  <p>and</p>
  
  <pre>
  def create
    diff_params = coerce(params)
    @upload = Upload.new(diff_params[:upload])
    ...
  end
  </pre>
  
  <p>What would be the best way of white listing file types?</p>
  
  <p>I am thinking a before_validation method, but I'm not sure how that would work. Any ideas would be welcome.</p>