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
When and where does num_saved get updated/changed? On Dec 13, 2005, at 5:11 PM, Carl Youngblood wrote:> 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 > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Carl Youngblood
2005-Dec-14 02:23 UTC
Re: Upload progress form not redirecting when finished
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. On 12/13/05, Joshua Paul <joshpaul-ee4meeAH724@public.gmane.org> wrote:> When and where does num_saved get updated/changed?