Forum: Ruby on Rails Upload Progress Bar not showing

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.
Bb742a985acaece76ff6f6373d00063d?d=identicon&s=25 Jon G. (jonthejester)
on 2006-04-25 00:42
Hi. I'm setting up an upload form for internal users of a Rails site,
and I'm trying to use the Upload Progress Bar plugin from
http://sean.treadway.info/demo/upload/. I followed the directions as set
out in the Rails Wiki
(http://wiki.rubyonrails.org/rails/pages/Upload+Progress+Bar).

Basically the problem is no progress bar or any upload information shows
up. In WEBrick, I just get "Upload starting..." and then "Upload
finished" after which the page gets redirected as I have it set up in
the view.

I also have my Rails application set up for Apache, so when I try the
same thing, upload a file, I get the same message, "Upload starting..."
then "Upload finished", only I don't get a redirect and the file I
uploaded isn't there.

This is what my uploads controller looks like:

class UploadsController < ApplicationController
  before_filter :authorize
  upload_status_for :new

[...]

  def new
    if request.get?
      @upload = Upload.new
    else
      @upload = Upload.new(@params["upload"])
      if @upload.save
        flash[:notice] = "File uploaded sueccessfully."
        redirect_to :action => "list"
      end
    end
  end
end

And the 'new' upload view:

<h3>Upload File</h3>

<%= form_tag_with_upload_progress %>
<p><input type="file" id="upload_file" name="upload[file]"/></p>

<%= render :partial => 'upload_form' %>

<p><input type="submit" value="Upload&hellip;"/></p>
<%= upload_status_tag %>
</form>

<p><%= link_to '&laquo; Show All Uploads', :action => 'list_uploads'
%></p>

Also, if this affects the uploading progress bar process, in my model
I'm specifying that I'll have the upload saved in the filesystem. Here
is what the 'upload' model looks like:

class Upload < ActiveRecord::Base
  has_one :movie
  belongs_to :movie

  def file=(upload_file)
    File.open("files/#{upload_file.original_filename}", "w") { |f|
f.write(upload_file.read) }
    self.filename = upload_file.original_filename
    self.content_type = upload_file.content_type
    self.size = upload_file.size.to_s
  end

  def before_destroy
    File.delete("files/#{self.filename}")
  end

  def file_data
    IO.read("files/#{self.filename}")
  end
end

For the reference, I'm on DreamHost, using Apache 1.3, Ruby 1.8.2, and
Ruby on Rails 1.1 (I have it installed in vendors/rails-1.1). Any help
on this would be much appreciated. Thanks.

-Jon
5476cbb7ad53bab7ca4b23e76371314f?d=identicon&s=25 Pratiksha Gajjar (pratiksha)
on 2006-09-23 15:52
Jon G. wrote:
> Hi. I'm setting up an upload form for internal users of a Rails site,
> and I'm trying to use the Upload Progress Bar plugin from
> http://sean.treadway.info/demo/upload/. I followed the directions as set
> out in the Rails Wiki
> (http://wiki.rubyonrails.org/rails/pages/Upload+Progress+Bar).
>




Hi Jon

Jon have u checked that sean teadways checklist link on that progress
bar's link u have specified.

First see checklist is shows the basic environment need to work progress
bar properly

- Pratiksha
Aae700553f2a6966f38a24f33effcb66?d=identicon&s=25 Hitesh (Guest)
on 2007-12-13 18:57
(Received via mailing list)
Did you get the progress bar work??

HItesh

On Sep 23 2006, 6:52 pm, Pratiksha Gajjar <rails-mailing-l...@andreas-
This topic is locked and can not be replied to.