Forum: Ruby on Rails Upload progress form not redirecting when finished

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Carl Y. (Guest)
on 2005-12-14 03:13
(Received via mailing list)
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"'}) %>
<br />
<%= file_field_tag 'zipfile', {:size => 30} %>
<br />
<%= submit_tag('Upload resumes') %>
<br />
<%= upload_status_tag %>
<%= end_form_tag %>

Is there something wrong with my code?

Thanks,

Carl
Joshua Paul (Guest)
on 2005-12-14 04:20
(Received via mailing list)
When and where does num_saved get updated/changed?
Carl Y. (Guest)
on 2005-12-14 04:26
(Received via mailing list)
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.
This topic is locked and can not be replied to.