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
Prashant T. 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. <
slash7 with Amy Hoy » Blog Archive » Help Vampires: A Spotter’s Guide >
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.
Charlie B. 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.
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.
Alan F. wrote:
Charlie B. 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.
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