Forum: Ruby on Rails file_column - blank folder created, no upload

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.
Remy Lopez (Guest)
on 2006-06-01 12:02
i want to upload and resize images so i installed the file_column plugin
but im having a big trouble, i have a table images with (id, name)
fields where the images names/path will be stored, i get a success
message(from the controller after @art_image.save) every time i try to
upload but only a blank directory its created /public/image/name/tmp ,
without errors messages, i see a post related to the same problem but i
coulndt find anything there that help to fix this.

By the way, im using rails1.1/ruby1.8.2(or RMagick wont work on
windows), windows and webrick, here is my code

#view-------index.rhtml
<h1>Upload</h1>

<%= form_tag({:action=>'create_art_image', :id=> @art_image}, :multipart
=> true)%>
<br/>
<%= file_column_field "image", "name" %>
<%= submit_tag 'Upload' -%>
<%= end_form_tag %>

#controller-------create_art_image action
def create_art_image
@art_image = Image.new(@params[:art_image])
        if @art_image.save
             flash[:notice] = 'Sucess.'
            redirect_to :action => 'index'
        else
             flash[:notice] = 'Error.'
            render :action => 'index'
        end
end

#model--------image.rb
class Image < ActiveRecord::Base
    file_column :name
end
Steve R. (Guest)
on 2006-06-02 05:45
(Received via mailing list)
It looks like you are on the right track with file_column. It would be a
shame to roll your own. Did you see a row in your database for the
image? If
not, look at your logs and see whether there's a good reason why.

--
View this message in context:
http://www.nabble.com/file_column----blank-folder-...
Sent from the RubyOnRails Users forum at Nabble.com.
Carmen -. (Guest)
on 2006-06-02 22:10
Steve R. wrote:
> It looks like you are on the right track with file_column. It would be a
> shame to roll your own

why would it be a shame? the file upload functionality i needed amounted
to about 5 lines of code. what would be a shame would be having to
additionally grab that plugin for each deployment when it wasnt
necessary..plus its often quicker to write something that learn someone
else's thing (this is especially true in 5 vs 27669 line scenarios)

plus youll learn something.

there are some things i wouldnt want to invent. like rails itself.. :)
Steve R. (Guest)
on 2006-06-02 22:22
(Received via mailing list)
It seems like a shame because file upload, and particularly image upload
is
so often performed. Add to that the handling of failed uploads and
creating
multiple sizes at upload time and you have significant functionality
that I
personally can't write in 5 lines of code and would prefer not to write
for
each app.

I know there's a debate whether this belongs in the view or the model,
but
that's OT for this thread.

That's all I was getting at.
--
View this message in context:
http://www.nabble.com/file_column----blank-folder-...
Sent from the RubyOnRails Users forum at Nabble.com.
This topic is locked and can not be replied to.