I need a simple image upload template for uploading a jpeg to the server... -- Anthony Ettinger Ph: 408-656-2473 var (bonita, farley) = new Dog; farley.barks("very loud"); bonita.barks ("at strangers"); http://chovy.dyndns.org/resume/ http://utuxia.com/consulting --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
From chapter 11 of Ruby on Rails for Dummies: Contents of Migration def self.up Create_table :photos do |t| t.column :picture, :blob t.column :description, :text end end def self.down drop_table :photos end Contents of _form.rhtml <%= error_messages_for ''photo'' %> <!--[form:photo]--> <p><label for="photo_picture">Picture</label><br/> <% file_field ''photo'', ''photo'' %></p> <p><label for="photo_description">Description</label><br/> <% text_area ''photo'', ''descriptionphoto'' %></p> <!--[eoform:photo]--> Contents of edit.rhtml <h1>Editing photo</h1> <%= start_form_tag( { :action => ''update'', :id => @photo }, :multipart => true) %> <%= render :partial => ''form'' %> <%= submit_tag ''Edit'' %> <%= end_form_tag %> Good luck! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 19, 1:42 pm, Denise Robinson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> From chapter 11 of Ruby on Rails for Dummies: > Contents of Migration > def self.up > Create_table :photos do |t| > t.column :picture, :blob > t.column :description, :text > end > end > > def self.down > drop_table :photos > end > > Contents of _form.rhtml > <%= error_messages_for ''photo'' %> > <!--[form:photo]--> > <p><label for="photo_picture">Picture</label><br/> > <% file_field ''photo'', ''photo'' %></p> > <p><label for="photo_description">Description</label><br/> > <% text_area ''photo'', ''descriptionphoto'' %></p> > <!--[eoform:photo]--> > > Contents of edit.rhtml > <h1>Editing photo</h1> > <%= start_form_tag( { :action => ''update'', > :id => @photo }, > :multipart => true) %> > <%= render :partial => ''form'' %> > <%= submit_tag ''Edit'' %> > <%= end_form_tag %> >Thanks, but there is no controller? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Use a plugin: http://svn.techno-weenie.net/projects/plugins/attachment_fu/ HTH, Nicholas On Nov 19, 3:50 pm, "Anthony Ettinger" <ettin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I need a simple image upload template for uploading a jpeg to the server... > > -- > Anthony Ettinger > Ph: 408-656-2473 > var (bonita, farley) = new Dog; > farley.barks("very loud"); > bonita.barks ("at strangers"); > > http://chovy.dyndns.org/resume/http://utuxia.com/consulting--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nicholas Henry wrote:> Use a plugin: > > http://svn.techno-weenie.net/projects/plugins/attachment_fu/ > > HTH, > Nicholasbit overkill for what I need -- i just was curious how I would integrate a controller into this, or where methods should go. anyway, its a start. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
How about this: http://manuals.rubyonrails.com/read/chapter/56 On Nov 19, 10:27 pm, "Anthony E." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Nicholas Henry wrote: > > Use a plugin: > > >http://svn.techno-weenie.net/projects/plugins/attachment_fu/ > > > HTH, > > Nicholas > > bit overkill for what I need -- i just was curious how I would integrate > a controller into this, or where methods should go. anyway, its a start. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nicholas Henry wrote:> How about this: > > http://manuals.rubyonrails.com/read/chapter/56 > > On Nov 19, 10:27 pm, "Anthony E." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
chovy wrote:> On Nov 19, 1:42 pm, Denise Robinson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> drop_table :photos >> >> Contents of edit.rhtml >> <h1>Editing photo</h1> >> <%= start_form_tag( { :action => ''update'', >> :id => @photo }, >> :multipart => true) %> >> <%= render :partial => ''form'' %> >> <%= submit_tag ''Edit'' %> >> <%= end_form_tag %> >> > > > Thanks, but there is no controller?Sorry. In photos_controller: def get_picture @photo=Photo.find(params[:id]) send_data(@photo.picture, :type=> ''image/jpeg'') end In Photo model: def photo=(photo_in) self.picture = photo_in.read end Contents of new.rhtml <h1>New photo</h1> <%= start_form_tag( { :action => ''create'' }, :multipart => true) %> <%= render :partial => ''form'' %> <%= submit_tag ''Create'' %> <%= end_form_tag %> Modify show.rhtml with this line (presumably this was scaffolded and then he suggesting adding this one line): <img src="<%url_for( :action => "get_picture", :id => @photo.id ) %>" /> <p> which is shown just above this (likely scaffolded) line: <b><%=photo.description %></b><p> There''s a tweak to the listing page too - looks like he replaced the table cells that were scaffolded with this: <td> <img src="<%url_for( :action => "get_picture", :id => @photo.id ) %>" height="100" /> </td> <td> <%= photo.send("description'') %> </td> The book has good explanations of what everything is doing. Even if you don''t want to buy the book, you could run down to your local book store and check it out. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Denise Robinson wrote:> The book has good explanations of what everything is doing. Even if you > don''t want to buy the book, you could run down to your local book store > and check it out.excellent...found the source too: http://users.drew.edu/bburd/RubyOnRails/ -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Anthony E. wrote:> Denise Robinson wrote: > >> The book has good explanations of what everything is doing. Even if you >> don''t want to buy the book, you could run down to your local book store >> and check it out. > > excellent...found the source too: > http://users.drew.edu/bburd/RubyOnRails/Perfect. :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---