Hello all, I get the message below when I try to use the file_column plugin in my app to upload files. I have followed the instructions on the file_column website and the RoR rails wiki with no luck. Any ideas? I would be happy to provide more details wrt my controller, view, model, etc should they be required! I am not doing anything crazy though so I think I am just overlooking something. Error: Do not know how to handle a string with value ''misc.jpg'' that was passed to a file_column. Check if the form''s encoding has been set to ''multipart/form-data''. Thanks in advance! Andrew -- ---------------------------------------------------- Gmail - Hits the spot! :-) GPG Key ID: 1024D/F18A34B9 2005-08-27 Andrew VanSpronsen (E-mail key) <avanspronsen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Your form needs to be rendered as multipart because it is handling binary data (the file being upload). In the view which displays the form with the file upload add ":multipart => true", as an example: <%= start_form_tag({:action=>''update'', :id => @category}, :multipart => true)%> hope that helps, Kris. Andrew VanSpronsen wrote:> Hello all, > > I get the message below when I try to use the file_column plugin in my > app to upload files. I have followed the instructions on the > file_column website and the RoR rails wiki with no luck. Any ideas? > > I would be happy to provide more details wrt my controller, view, > model, etc should they be required! I am not doing anything crazy > though so I think I am just overlooking something. > > > > Error: > Do not know how to handle a string with value ''misc.jpg'' that was > passed to a file_column. Check if the form''s encoding has been set to > ''multipart/form-data''. > > > Thanks in advance! > > Andrew > ---- Posted via http://www.ruby-forum.com/.
Perfect! I had that statement but not with the brackets as you did. Thanks so much! Andrew On 12/13/05, Kris Leech <krisleech-BSIDdvZawMx9qp0gCGiW7Q@public.gmane.org> wrote:> > Your form needs to be rendered as multipart because it is handling > binary data (the file being upload). > > In the view which displays the form with the file upload add ":multipart > => true", as an example: > > <%= start_form_tag({:action=>''update'', :id => @category}, :multipart => > true)%> > > > hope that helps, Kris. > > > Andrew VanSpronsen wrote: > > Hello all, > > > > I get the message below when I try to use the file_column plugin in my > > app to upload files. I have followed the instructions on the > > file_column website and the RoR rails wiki with no luck. Any ideas? > > > > I would be happy to provide more details wrt my controller, view, > > model, etc should they be required! I am not doing anything crazy > > though so I think I am just overlooking something. > > > > > > > > Error: > > Do not know how to handle a string with value ''misc.jpg'' that was > > passed to a file_column. Check if the form''s encoding has been set to > > ''multipart/form-data''. > > > > > > Thanks in advance! > > > > Andrew > > -- > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- ---------------------------------------------------- Gmail - Hits the spot! :-) GPG Key ID: 1024D/F18A34B9 2005-08-27 Andrew VanSpronsen (E-mail key) < avanspronsen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I have been trying to use file_column, and it does work partially, the files are uploaded to my server, but then when I do @user.icon it returns nil. My file_column definition looks like this: file_column :icon, :magick => {:size => "100x100" } I display it in a form (with multipart) like this: <%= file_column_field ''user'', ''icon'' %> I have noticed in the params that the icon is a StringIO (which is normal for files under 10kb), but icon_temp is nil. I am using file_column .3.1. Thanks, Ben Hiller -- Posted via http://www.ruby-forum.com/.
Hi Ben, On 12/31/05, Ben Hiller <benhiller@gmail.com> wrote:> I have been trying to use file_column, and it does work partially, the > files are uploaded to my server, but then when I do @user.icon it > returns nil. My file_column definition looks like this: file_column > :icon, :magick => {:size => "100x100" }have you added a varchar column to your users table? This column will hold the filename. Sebastian
> have you added a varchar column to your users table? This column will > hold the filename. > > SebastianThanks, it now stores the URL, but when I try and access the image, it gives me a routing error. -- Posted via http://www.ruby-forum.com/.
Ben Hiller wrote:>> have you added a varchar column to your users table? This column will >> hold the filename. >> >> Sebastian > > Thanks, it now stores the URL, but when I try and access the image, it > gives me a routing error. >Make sure to use a file with an extension like `.pdf`. A file without an extension like `README` will result in an routing error due to the stuff in .htaccess or the default lighttpd config. Jonathan -- Jonathan Weiss http://blog.innerewut.de
> Make sure to use a file with an extension like `.pdf`. A file without an > extension like `README` will result in an routing error due to the stuff > in .htaccess or the default lighttpd config. > > JonathanI am using .jpg''s, although could my .htaccess or lighttpd config be messed incorrect, since I am on Dreamhost? -- Posted via http://www.ruby-forum.com/.
Ben Hiller wrote:>> Make sure to use a file with an extension like `.pdf`. A file without an >> extension like `README` will result in an routing error due to the stuff >> in .htaccess or the default lighttpd config. >> >> Jonathan > > I am using .jpg''s, although could my .htaccess or lighttpd config be > messed incorrect, since I am on Dreamhost? >If you use Apache it is most likely that they allow you `.htaccess` files and then it is under your control. But unless you changed it this problem affects only files with no extension. How to you access the image? In the accessing view you need: <%= url_for_file_column ''user'', ''icon'' %> Jonathan -- Jonathan Weiss http://blog.innerewut.de
> How to you access the image? > > JonathanI use this: <%= image_tag url_for_file_column(''user'', ''icon''), { :class => ''profilepic'' } %> Which is equivalent to what you said, right? -- Posted via http://www.ruby-forum.com/.
Ben Hiller wrote:>> How to you access the image? >> >> JonathanI figured out the problem. For some reason the images were created with incorrect permissions, which caused them to not be accessible. -- Posted via http://www.ruby-forum.com/.