Directly use UploadedFile object if available.

Opera doesn't support XHR file uploads and instead submits a regular form.
Thus, we are provided with an UploadedFile object which can be used instead of creating our own compatible object.
This commit is contained in:
John Edmonds 2011-09-25 11:48:59 -04:00
parent 8a44b384c0
commit 5f906defc8

View file

@ -49,7 +49,11 @@ class PhotosController < ApplicationController
params[:photo][:aspect_ids] = params[:photo][:aspect_ids].values
end
params[:photo][:user_file] = file_handler(params)
params[:photo][:user_file] = if request.params.has_key?(:qqfile) and not request.params[:qqfile].is_a?(String)
params[:qqfile]
else
file_handler(params)
end
@photo = current_user.build_post(:photo, params[:photo])