Skip to content
Browse files

Made Upload Progress work with Prototype 1.4.0 and add some documenta…

…tion for it #1847, #1876 [Thomas Fuchs/Sean Treadway]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2059 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 68c90ab commit b80f0e2ff3a51e6166e4e29b87a7380f42529e7a @dhh dhh committed Aug 27, 2005
View
52 actionpack/lib/action_controller/upload_progress.rb
@@ -13,6 +13,9 @@ module ActionController #:nodoc:
# fully on all the systems that is a part of your environment. Consider this an extended
# preview.
#
+ # To enable this module, add <tt>ActionController::Base.enable_upload_progress</tt> to your
+ # config/environment.rb file.
+ #
# == Action Pack Upload Progress for multipart uploads
#
# The UploadProgress module aids in the process of viewing an Ajax driven
@@ -131,6 +134,55 @@ module ActionController #:nodoc:
# def custom_status
# render :inline => '<%= upload_progress_status %> <div>Updated at <%= Time.now %></div>', :layout => false
# end
+ #
+ # ==== Environment checklist
+ #
+ # This is an experimental feature that requires a specific webserver environment. Use the following checklist
+ # to confirm that you have an environment that supports upload progress.
+ #
+ # ===== Ruby:
+ #
+ # * Running the command `ruby -v` should print "ruby 1.8.2 (2004-12-25)" or older
+ #
+ # ===== Web server:
+ #
+ # * Apache 1.3, Apache 2.0 or Lighttpd *1.4* (need to build lighttpd from CVS)
+ #
+ # ===== FastCGI bindings:
+ #
+ # * > 0.8.6 and must be the compiled C version of the bindings
+ # * The command `ruby -e "p require('fcgi.so')"` should print "true"
+ #
+ # ===== Apache/Lighttpd FastCGI directives:
+ #
+ # * You must allow more than one FCGI server process to allow concurrent requests.
+ # * If there is only a single FCGI process you will not get the upload status updates.
+ # * You can check this by taking a look for running FCGI servers in your process list during a progress upload.
+ # * Apache directive: FastCGIConfig -minProcesses 2
+ # * Lighttpd directives taken from config/lighttpd.conf (min-procs):
+ #
+ # fastcgi.server = (
+ # ".fcgi" => (
+ # "APP_NAME" => (
+ # "socket" => "/tmp/APP_NAME1.socket",
+ # "bin-path" => "RAILS_ROOT/public/dispatch.fcgi",
+ # "min-procs" => 2
+ # )
+ # )
+ # )
+ #
+ # ===== config/environment.rb:
+ #
+ # * Add the following line to your config/environment.rb and restart your web server.
+ # * <tt>ActionController::Base.enable_upload_progress</tt>
+ #
+ # ===== Development log:
+ #
+ # * When the upload progress is enabled by you will find something the following lines:
+ # * "Multipart upload with progress (id: 1, size: 85464)"
+ # * "Finished processing multipart upload in 0.363729s"
+ # * If you are properly running multiple FCGI processes, then you will see multiple entries for rendering the "upload_status" action before the "Finish processing..." log entry. This is a *good thing* :)
+ #
module UploadProgress
def self.append_features(base) #:nodoc:
super
View
2 actionpack/lib/action_view/helpers/upload_progress_helper.rb
@@ -196,7 +196,7 @@ def form_tag_with_upload_progress(url_for_options = {}, options = {}, status_url
updater = "if (#{upload_update_object}) { #{upload_update_object}.stop(); }"
updater << "#{upload_update_object} = new Ajax.PeriodicalUpdater('#{status_tag_id}',"
- updater << "'#{status_url}', #{options_for_ajax(options)}.extend(#{updater_options}))"
+ updater << "'#{status_url}', Object.extend(#{options_for_ajax(options)},#{updater_options}))"
updater = "#{options[:begin]}; #{updater}" if options[:begin]
updater = "#{upload_progress_update_bar_js(0)}; #{updater}"

0 comments on commit b80f0e2

Please sign in to comment.
Something went wrong with that request. Please try again.