Anyone here haveRails 3 with Uploadify & Paper_Clip experience?
I'd like to allow the user to upload photos:
Here is my view:
<input id="fileInput" name="fileInput" type="file" />
<script type="text/javascript">
$(document).ready(function() {
$('#fileInput').uploadify({
uploader : '/uploadify/uploadify.swf',
fileDataName : 'photo[file]',
script : '/photos/upload',
cancelImg : '/uploadify/cancel.png',
auto : true,
scriptData : {
'_http_accept': 'application/javascript',
'_method': 'put',
"<%= key = Rails.application.config.session_options[:key] %>" : "<%= cookies[key] %>",
"<%= request_forgery_protection_token %>" : "<%= form_authenticity_token %>"
}
});
});
</script>
My Controller:
def upload
@photo = Photo.create(params[:file])
respond_to do |format|
format.json
end
end
My Model: #Paperclip for photo has_attached_file :photo, . . .
PROBLEM... is when I use uploadify to render, if errors, In the logs it shows:
Started POST "/photos/upload" for 127.0.0.1 at Sun Oct 24 12:16:38 -0700 2010
Processing by PhotosController#upload as HTML
Parameters: {"photo"=>{"file"=>#<File:/var/folders/lF/lF0Ne5vGFj44kV54W3zBdU+++TI/-Tmp-/RackMultipart20101024-34605-sqvg1m-0>}, "_http_accept"=>"application/javascript", "Filename"=>"whiteboard_2.jpg", "folder"=>"/projects/3/photo_albums/", "authenticity_token"=>"l9TqKh1Q7/8riUjuPMj7QtiJwNNxvBKfENnTx/ijP3E=", "Upload"=>"Submit Query", "_cline_session"=>"BAh7CCIQX2NzcmZfdG9rZW4iMWw5VHFLaDFRNy84cmlVanVQTWo3UXRpSndOTnh2QktmRU5uVHgvaWpQM0U9Ig9zZXNzaW9uX2lkIiVmYjYyYmM5YjU0YTBkMWMwNWZmMDQ3NmE1NzU1YTE1YSIZd2FyZGVuLnVzZXIudXNlci5rZXlbByIJVXNlcmkG--f5b0cb3a6b775b2cc15eb30b20aa3c3f558b0412"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE ("users"."id" = 1) LIMIT 1
SQL (0.4ms) INSERT INTO "photos" ("created_at", "description", "photo_content_type", "photo_file_name", "photo_file_size", "photo_updated_at", "title", "updated_at", "user_id") VALUES ('2010-10-24 19:16:39.042342', NULL, NULL, NULL, NULL, NULL, NULL, '2010-10-24 19:16:39.042342', NULL)
[paperclip] Saving attachments.
Completed 406 Not Acceptable in 50ms
Any ideas why Rails isn't getting the uploaded file?
Thanks