Hi, I have one form , in which I am using file_field teg for input image file as follows. ====<%= file_field("store", "picture") %> ======Tha Actual fileld name of my Image field in Database is "store_photo" with datatype LargeBLOB. & Inside my Store Model I have specified "def picture" as follows:- ========================def picture=(picture_field) self.store_photo = picture_field.read end ======================== Now When I am trying to Uplaod file by submitting form I am getting error like:- =====================================undefined method `read'' for "logo.gif":String =====================================Why I am getting this error? PLease tell me how to upload file into my database from a form & also if later I want to retrieve that image from database & display it on page how to do it? Thanx. Prash -- Posted via http://www.ruby-forum.com/.
Prashant Tiwari wrote:> Why I am getting this error? PLease tell me how to upload file into my > database from a form & also if later I want to retrieve that image from > database & display it on page how to do it?Hi Prashant, I''m sorry to be the first to do this, but I''m calling Help Vampire. < http://slash7.com/pages/vampires > Have you looked at the documentation for file_field ? It looks like what you think is the object is actually just the filename. Perhaps file_field documentation can help you diagnose this problem. You might also consider whether any changes need to be made to the form itself to facilitate a multiple part submission, file data and params. A. -- Posted via http://www.ruby-forum.com/.
Take a look at file_column Should do what you want http://wiki.rubyonrails.org/rails/pages/File+Column+Plugin On 4/5/06, Prashant Tiwari <tiwari_p_k@yahoo.com> wrote:> > Hi, > > I have one form , in which I am using file_field teg for input image > file as follows. > ====> <%= file_field("store", "picture") %> > ======> Tha Actual fileld name of my Image field in Database is "store_photo" > with datatype LargeBLOB. > & Inside my Store Model I have specified "def picture" as follows:- > ========================> def picture=(picture_field) > self.store_photo = picture_field.read > end > ========================> > Now When I am trying to Uplaod file by submitting form I am getting > error like:- > =====================================> undefined method `read'' for "logo.gif":String > =====================================> Why I am getting this error? PLease tell me how to upload file into my > database from a form & also if later I want to retrieve that image from > database & display it on page how to do it? > > Thanx. > Prash > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060405/df96f0f2/attachment-0001.html
This is exactly why the "Help Vampire" Post pissed me off so much. It''s a stupid phrase and should never be used. That post will do more damage to the community than 1 million "bad" questions. On Wed, 2006-04-05 at 14:54 +0200, Alan Francis wrote:> Prashant Tiwari wrote: > > Why I am getting this error? PLease tell me how to upload file into my > > database from a form & also if later I want to retrieve that image from > > database & display it on page how to do it? > > Hi Prashant, > > I''m sorry to be the first to do this, but I''m calling Help Vampire. < > http://slash7.com/pages/vampires > > > Have you looked at the documentation for file_field ? It looks like > what you think is the object is actually just the filename. Perhaps > file_field documentation can help you diagnose this problem. > > You might also consider whether any changes need to be made to the form > itself to facilitate a multiple part submission, file data and params. > > A. > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060405/c4f40aaa/attachment.html
Charlie Bowman wrote:> This is exactly why the "Help Vampire" Post pissed me off so much. It''s > a stupid phrase and should never be used. That post will do more damage > to the community than 1 million "bad" questions.You may be entirely correct. I hovered a while before sending, not at all sure whether to do it or not. Apologies if it offended anyone, but I feel the rest of the mail stands. A. -- Posted via http://www.ruby-forum.com/.
Alan Francis wrote:> Charlie Bowman wrote: >> This is exactly why the "Help Vampire" Post pissed me off so much. It''s >> a stupid phrase and should never be used. That post will do more damage >> to the community than 1 million "bad" questions. > > You may be entirely correct. I hovered a while before sending, not at > all sure whether to do it or not. Apologies if it offended anyone, but > I feel the rest of the mail stands. > > A.And FWIW, I agree it''s a stupid name for a very real thing. A. -- Posted via http://www.ruby-forum.com/.
I agree with the principle, and I agree that it is real. As a reforming .NET user, I can attest to the pitiful state of many of the various communities because of this very real problem. Nothing is more frustrating than a list being overwhelmed with questions from those who won''t take the time to do a tiny bit of research before asking someone else to do it for them. A community is about give AND take. If you take too much, people ignore you, and if everyone only takes, then the community disintegrates. Matt On 4/5/06, Alan Francis <alancfrancis@gmail.com> wrote:> > Alan Francis wrote: > > Charlie Bowman wrote: > >> This is exactly why the "Help Vampire" Post pissed me off so > much. It''s > >> a stupid phrase and should never be used. That post will do more > damage > >> to the community than 1 million "bad" questions. > > > > You may be entirely correct. I hovered a while before sending, not at > > all sure whether to do it or not. Apologies if it offended anyone, but > > I feel the rest of the mail stands. > > > > A. > > And FWIW, I agree it''s a stupid name for a very real thing. > > A. > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060405/93965e01/attachment.html