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/ 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…