# Upload Progress Bar Problems

**URL:** <https://www.ruby-forum.com/t/upload-progress-bar-problems/51746>\
**Category:** Rails\
**Created:** [January 6, 2006, 4:53pm UTC](https://www.ruby-forum.com/t/upload-progress-bar-problems/51746 "2006-01-06T16:53:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![agnathan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@agnathan](https://www.ruby-forum.com/u/agnathan)\
**Post date:** [January 6, 2006, 4:53pm UTC](https://www.ruby-forum.com/t/upload-progress-bar-problems/51746/1 "2006-01-06T16:53:52Z")

</div>

I’m writing an application where the user will be uploading many images  
and user feedback is essential.

I’ve been trying to get the upload progress bar plug-in to work, but  
thus far have not had any success.

I’ve downloaded Sean Treadway’s application code from his site  
[http://sean.treadway.info/demo/upload/](http://sean.treadway.info/demo/upload/) and I followed the steps in his  
Upload Progress Checklist.

I’ve tried this on both my Gentoo and WinXP boxes using the Rails 1.0.

def upload  
case @request.method  
when :post  
@message = 'File uploaded: ’ +  
params[:document][:file].size.to\_s

```
      upload_progress.message = "Simulating some file processing 

```

stage 1…"  
session.update

```
      # Dump information about uploads
      @session[:uploads].each {|k,v| logger.debug("Debug: 

```

#{k}-----\>#{v.completed\_percent}")}

```
      sleep(3)

      upload_progress.message = "Continuing processing stage 2..."
      session.update
      sleep(3)

      redirect_to :action => 'show'

      finish_upload_status "Hello '#{@message}'"
  end

```

end

My problem is that no matter the file size by the time to debug  
statement is reached the entire file has always been uploaded. So the  
progress bar jumps from 1 to 100 with no in between steps. I can step  
through with a debugger and see this session being updated with file  
size, bit rate, etc. information as the file is being uploaded, but no  
luck with the bar.

Should I resign myself to putting up a pretty swirly animated graphic  
and telling the user “it won’t be long now” ? has anybody had any  
success with the getting the upload progress bar to work? can anybody  
provide any sample application code or suggest alternatives to using the  
progress bar? thanks for any help…

---

<div class="post-metadata">

**Author:** ![agnathan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@agnathan](https://www.ruby-forum.com/u/agnathan)\
**Post date:** [April 11, 2006, 8:21am UTC](https://www.ruby-forum.com/t/upload-progress-bar-problems/51746/2 "2006-04-11T08:21:45Z")

</div>

Hi,

I too have Rails 1.0 running under apache. But I am getting error  
message for form\_tag\_with\_upload\_progress, it seems it’s not identifying  
this tag. The same happens in Rails 1.1. It would be very kind of you if  
you can tell me something in this regard.

cheers…  
Prasad

Daniel Holmlund wrote:

> I’m writing an application where the user will be uploading many images  
> and user feedback is essential.
> 
> I’ve been trying to get the upload progress bar plug-in to work, but  
> thus far have not had any success.
> 
> I’ve downloaded Sean Treadway’s application code from his site  
> [http://sean.treadway.info/demo/upload/](http://sean.treadway.info/demo/upload/) and I followed the steps in his  
> Upload Progress Checklist.
> 
> I’ve tried this on both my Gentoo and WinXP boxes using the Rails 1.0.
> 
> def upload  
> case @request.method  
> when :post  
> @message = 'File uploaded: ’ +  
> params[:document][:file].size.to\_s
> 
> ```
> upload_progress.message = "Simulating some file processing 
> 
> ```
> 
> stage 1…"  
> session.update
> 
> ```
> # Dump information about uploads
> @session[:uploads].each {|k,v| logger.debug("Debug: 
> 
> ```
> 
> #{k}-----\>#{v.completed\_percent}")}
> 
> ```
> sleep(3)
> 
> upload_progress.message = "Continuing processing stage 2..."
> session.update
> sleep(3)
> 
> redirect_to :action => 'show'
> 
> finish_upload_status "Hello '#{@message}'"
> end
> 
> ```
> 
> end
> 
> My problem is that no matter the file size by the time to debug  
> statement is reached the entire file has always been uploaded. So the  
> progress bar jumps from 1 to 100 with no in between steps. I can step  
> through with a debugger and see this session being updated with file  
> size, bit rate, etc. information as the file is being uploaded, but no  
> luck with the bar.
> 
> Should I resign myself to putting up a pretty swirly animated graphic  
> and telling the user “it won’t be long now” ? has anybody had any  
> success with the getting the upload progress bar to work? can anybody  
> provide any sample application code or suggest alternatives to using the  
> progress bar? thanks for any help…

---

<div class="post-metadata">

**Author:** ![agnathan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@agnathan](https://www.ruby-forum.com/u/agnathan)\
**Post date:** [April 11, 2006, 8:29am UTC](https://www.ruby-forum.com/t/upload-progress-bar-problems/51746/3 "2006-04-11T08:29:35Z")

</div>

Daniel,

I tried to get this working for a couple of days on Rails 1.0 and ended  
up at the exact same place.

What I think that I observed was that the Ajax calls to do the updating  
would not start until the file upload was complete, then the  
intermediate status polling would begin. So it would go from 0% to 100%  
and then I would see the Ajax periodical updater calls happen.

Unfortunately, I finally gave up. I did not get to debugging within the  
upload code - I did my debugging on the client side, but my results are  
consistent with yours.

Because this was my very first experience with Ajax and Prototype I  
thought it best to get some other Ajax stuff working first before I came  
back to it. If you want to try and work through it together, perhaps we  
could do that.

FWIW, you’re not alone ;).

Thanks,  
Wes

(Aside, As I said this was on Rails 1.0 - looks like all of these  
components moved or disappeared for 1.1 - if you have any insight into  
where they are in the 1.1 distribution, please advise…)

Daniel Holmlund wrote:

> I’m writing an application where the user will be uploading many images  
> and user feedback is essential.
> 
> I’ve been trying to get the upload progress bar plug-in to work, but  
> thus far have not had any success.
> 
> I’ve downloaded Sean Treadway’s application code from his site  
> [http://sean.treadway.info/demo/upload/](http://sean.treadway.info/demo/upload/) and I followed the steps in his  
> Upload Progress Checklist.
> 
> I’ve tried this on both my Gentoo and WinXP boxes using the Rails 1.0.
> 
> def upload  
> case @request.method  
> when :post  
> @message = 'File uploaded: ’ +  
> params[:document][:file].size.to\_s
> 
> ```
> upload_progress.message = "Simulating some file processing 
> 
> ```
> 
> stage 1…"  
> session.update
> 
> ```
> # Dump information about uploads
> @session[:uploads].each {|k,v| logger.debug("Debug: 
> 
> ```
> 
> #{k}-----\>#{v.completed\_percent}")}
> 
> ```
> sleep(3)
> 
> upload_progress.message = "Continuing processing stage 2..."
> session.update
> sleep(3)
> 
> redirect_to :action => 'show'
> 
> finish_upload_status "Hello '#{@message}'"
> end
> 
> ```
> 
> end
> 
> My problem is that no matter the file size by the time to debug  
> statement is reached the entire file has always been uploaded. So the  
> progress bar jumps from 1 to 100 with no in between steps. I can step  
> through with a debugger and see this session being updated with file  
> size, bit rate, etc. information as the file is being uploaded, but no  
> luck with the bar.
> 
> Should I resign myself to putting up a pretty swirly animated graphic  
> and telling the user “it won’t be long now” ? has anybody had any  
> success with the getting the upload progress bar to work? can anybody  
> provide any sample application code or suggest alternatives to using the  
> progress bar? thanks for any help…
