I am using javascript to select a file and then to show the file upload progress. I would also like to be able to modify other attributes of the file.
<script type='text/javascript'>
var swfu;
window.onload = function () {
swfu = new SWFUpload({
upload_url : '<%= new_image_path_with_session_information %>',
flash_url : '/flash/swfupload.swf',
// Button settings
button_image_url: "/images/TestImageNoText_65x29.png",
button_width: "75",
button_height: "29",
button_placeholder_id: "spanButtonPlaceHolder",
button_text: '<span class="theFont">File</span>',
button_text_style: ".theFont { font-size: 16; }",
button_text_left_padding: 12,
button_text_top_padding: 3,
file_size_limit : '10000',
file_types : '*.jpg',
file_types_description : 'JPG Images',
file_upload_limit : '0',
custom_settings : {
progressTarget : "fsUploadProgress"
},
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
post_params : {
authenticity_token : '<%= u form_authenticity_token -%>',
},
custom_settings : {
upload_target : 'divFileProgressContainer',
},
debug: false
});
};
</script>
<div style="margin: 0px 10px;">
<div>
<%= form_for(@image) do |f| %>
<fieldset>
<div id="divStatus">Upload an image</div>
<div class="field">
<p>
<b><%= f.label :state_id %></b><br />
<%= f.collection_select :state_id, State.all, :id, :name %>
</p>
</div>
<div>
<span id="spanButtonPlaceHolder"></span>
</div>
</fieldset>
<% end %>
</div>
<div id="divFileProgressContainer" style="height: 75px;"></div>
<div id="thumbnails"></div>
</div>
At the bottom there is the familiar rails form, how can I include that value into the POST request?