Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: ActionView::Helpers::UploadProgressHelper
  • 1.0.0 (0)
  • 1.1.6
  • 1.2.6
  • 2.0.3
  • 2.1.0
  • 2.2.1
  • 2.3.8
  • 3.0.0
  • 3.0.9
  • 3.1.0
  • 3.2.1
  • 3.2.8
  • 3.2.13
  • 4.0.2
  • 4.1.8
  • 4.2.1
  • 4.2.7
  • 4.2.9
  • 5.1.7
  • 5.2.3
  • 6.0.0
  • 7.0.0
  • What's this?

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1.0.0) is shown here.

form_tag_with_upload_progress(url_for_options = {}, options = {}, status_url_for_options = {}, *parameters_for_url_method) public

Creates a form tag and hidden <iframe> necessary for the upload progress status messages to be displayed in a designated div on your page.


When the upload starts, the content created by upload_status_tag will be filled out with "Upload starting…". When the upload is finished, "Upload finished." will be used. Every update inbetween the begin and finish events will be determined by the server upload_status action. Doing this automatically means that the user can use the same form to upload multiple files without refreshing page while still displaying a reasonable progress.

Upload IDs

For the view and the controller to know about the same upload they must share a common upload_id. form_tag_with_upload_progress prepares the next available upload_id when called. There are other methods which use the upload_id so the order in which you include your content is important. Any content that depends on the upload_id will use the one defined form_tag_with_upload_progress otherwise you will need to explicitly declare the upload_id shared among your progress elements.

Status container after the form:

  <%= form_tag_with_upload_progress %>
  <%= end_form_tag %>

  <%= upload_status_tag %>

Status container before form:

  <% my_upload_id = next_upload_id %>

  <%= upload_status_tag %>

  <%= form_tag_with_upload_progress :upload_id => my_upload_id %>
  <%= end_form_tag %>

It is recommended that the helpers manage the upload_id parameter.


form_tag_with_upload_progress uses similar options as form_tag yet accepts another hash for the options used for the upload_status action.

url_for_options:The same options used by form_tag including:
:upload_id:the upload id used to uniquely identify this upload
options:similar options to form_tag including:
:begin:Javascript code that executes before the first status update occurs.
:finish:Javascript code that executes after the action that receives the post returns.
:frequency:number of seconds between polls to the upload status action.
status_url_for_options:options passed to url_for to build the url

for the upload status action.

:controller:defines the controller to be used for a custom update status action
:action:defines the action to be used for a custom update status action

Parameters passed to the action defined by status_url_for_options

:upload_id:the upload_id automatically generated by form_tag_with_upload_progress or the user defined id passed to this method.
Show source
Register or log in to add new notes.