ruby - Rails - how to save text data with Uploadify? -
i have page, can put text , text need add several images. uploading images want use uploadify.
now solving problem, when choose images , send form, data not sent, uploadify start transfer files. text information not transferred.
i doing way:
%script{:type => "text/javascript"} - session_key = rails.application.config.session_options[:key] $(document).ready(function() { $('#file_upload').click(function(event){ event.preventdefault(); }); $('#file_upload'). ({ 'uploader' : '/uploadify/uploadify.swf', 'cancelimg' : '/assets/uploadify-cancel.png', 'multi' : true, 'auto' : false, 'queueid' : "file_queue", 'script' : '/users/#{params[:user_id]}/listings', 'onclearqueue' : true, onallcomplete : function(queuedata) { $('#upload_next').removeclass('disabled'); }, 'oncomplete' : false, 'scriptdata' : { '_http_accept': 'application/javascript', /'format' : 'json', ????????????? '_method': 'post', '#{session_key}' : encodeuricomponent('#{u cookies[session_key]}'), 'authenticity_token': encodeuricomponent('#{u form_authenticity_token}'), 'text1' : $('#text1').val(), 'text2' : $('#text2').val(), 'text3' : $('#text3').val(), 'text4' : $('#text4').val() } }); $('#photo_submit').click(function(event){ event.preventdefault(); $('#file_upload').uploadifyupload(); }); });
is there way attach these text data upload? , also, how make redirect when upload (all data form saved) done?
thanks million times!
this can done sending data along image using formdata
attribute in uploadify.
scriptdata
attribute not in use.
for setting uploadify rails can visit http://vignesh.info/blog/rails-4-uploadify-paperclip/
Comments
Post a Comment