Upload progress form not redirecting when finished


#1

Hello, I have an upload action in one of my controllers that looks like
this:

upload_status_for :upload
def upload
if @request.post?
# do some stuff
upload_progress.message = “Processing uploaded files…”
session.update
# do some more stuff
upload_progress.message = “#{num_saved} resume(s) processed…”
session.update
# do some more stuff
upload_progress.message = “#{num_saved} resume(s) uploaded
successfully”
finish_upload_status = “#{num_saved} resume(s) uploaded successfully”
session.update
if num_saved > 0
redirect_to :action => :index
end
end
end

The operation finishes successfully, but the user never gets
redirected to the index action. Just in case it’s important, here is
the relevant section of the view code:

<%= form_tag_with_upload_progress({:action => ‘upload’},
{:finish => ‘uploadstatus.innerHTML = “Document Uploaded”’}) %>


<%= file_field_tag ‘zipfile’, {:size => 30} %>


<%= submit_tag(‘Upload resumes’) %>


<%= upload_status_tag %>
<%= end_form_tag %>

Is there something wrong with my code?

Thanks,

Carl


#2

When and where does num_saved get updated/changed?


#3

I omitted the portions that update it. There’s more stuff to the
upload action that increments it. That portion seems to be working
fine.