0.0
No commit activity in last 3 years
No release in over 3 years
thin_upload provides upload progress measuring functionality for thin ruby server, progresses can be accessed via rack middleware.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

<img src=“http://travis-ci.org/dombesz/thin_upload.png” />

Install¶ ↑

gem install thin_upload --pre

Usage¶ ↑

In your Gemfile

gem "thin"
gem "thin_upload", "~> 0.0.1.pre"

Note: Works only with thin server!

Upload progress is available for any file upload request.

Example:

<iframe id="upload_frame" name="upload_frame" style="width: 0px; height: 0px;"></iframe>

<%= form_tag(photos_path, {:multipart => true ,:target=>"upload_frame"}) do %>
  <%= text_field_tag :uuid, UUID.new.generate %>
  <%= file_field_tag :file %>
  <p><%= submit_tag "Continue &rarr;".html_safe, :id=>'submit_form' %></p>
<% end %>

To have progress tracking, we need to send a +uuid param in the submited form, and the +uuid param MUST be before the file field.

If you want to ask for progress use get request.

$.getJSON('/progress?uuid='+$("#uuid").attr('value'),function(response){
 //process response
});

While your upload is processing you can request the progress from rack.

@progress = request.env['rack.progress'][params[:uuid]]
@progress is an integer in range 0..100 or nil if doesn't exists

Note: This is just an experiment, it’s not production ready. Any suggestions are welcome.