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 -- Posted via http://www.ruby-forum.com/.
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-created%2C-no-upload-t1715324.html#a4672823 Sent from the RubyOnRails Users forum at Nabble.com.
Steve Ross wrote:> It looks like you are on the right track with file_column. It would be a > shame to roll your ownwhy 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.. :) -- Posted via http://www.ruby-forum.com/.
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-created%2C-no-upload-t1715324.html#a4684476 Sent from the RubyOnRails Users forum at Nabble.com.