Form_tag_with_upload_progress

hi all!

i have a PictureController with an upload action:

class PictureController < ApplicationController
.
.
.
upload_status_for :upload
.
.
.
def upload
if params[:picture]
@message = "File uploaded: " + params[:picture][:file].size.to_s
picture = Picture.save(params[:picture])
session.update
finish_upload_status “’#{@message}’”
end
end
.
.
.
end

and the model:

class Picture < ActiveRecord::Base
.
.
def self.save(picture)
#save the picture here
end
.
.
end

and the view:

<%= form_tag_with_upload_progress({:action => ‘upload’}, {:begin => “new
Effect.Appear(‘status1’)”, :finish => “new
Ajax.Request(’/picture/upload’, {asynchronous:true});” }) %>
.
.
<%= file_field ‘picture’, ‘file’ %>
<%= submit_tag ‘Upload’ %>


<%= upload_status_tag %>

<%= end_form_tag %>

after finish upload it makes an ajax request to the same action,
this works fine but if i take a look at the console where i have started
the webbrick server, i can see that it calls permanently the
/picture/upload_status?upload_id=… with different frequencies
this can’t be correct??
what am i doing wrong??

thanks for help!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs