Hi All,
I got the Error message when i try to upload a image file into database
using Ruby on Rails ,
PGError: ERROR:  unterminated quoted string at or near
"''����"
LINE 1: ...O photos ("description", "picture")
VALUES(''flower'', ''����
                                                                  ^
: INSERT INTO photos ("description", "picture")
VALUES(''flower'',
''�����JFIF��`�`�����C�
.....
.....
...............
......................
...............
.........
#%$""!&+7/&)4)!"0A149;>>>%.DIC<H7=>;���C'')
I am using
DataBase :Postgresql 8.2 version
OS : windowsXp
Rails : version 1.2.4 and server : mongrel
If anybody could know the solution for above problem, let me know as
soon as possible.
Thanks in advance.
-- 
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I would recommend storing them in base64 format. require ''base64'' ascii = Base64::encode64(binary) binary = Base64::decode64(ascii) You could do this in a filter of course. I just made a dummy attribute called "image_binary" which, upon setting, base64 encodes the data, and when reading base64 decodes it. --Michael On 10/19/07, Priya Selvaraj <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi All, > > I got the Error message when i try to upload a image file into database > using Ruby on Rails , > > PGError: ERROR: unterminated quoted string at or near "''����" > LINE 1: ...O photos ("description", "picture") VALUES(''flower'', ''���� > ^ > : INSERT INTO photos ("description", "picture") VALUES(''flower'', > ''����� JFIF� �`�`�����C� > > > ..... > ..... > ............... > ...................... > ............... > ......... > > > > # %$" "!&+7/&)4)!"0A149;>>>%.DIC<H7=>;���C '') > > > I am using > DataBase :Postgresql 8.2 version > OS : windowsXp > Rails : version 1.2.4 and server : mongrel > > If anybody could know the solution for above problem, let me know as > soon as possible. > > Thanks in advance. > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Graff wrote:> I would recommend storing them in base64 format. > > > require ''base64'' > > ascii = Base64::encode64(binary) > > binary = Base64::decode64(ascii) > > You could do this in a filter of course. I just made a dummy > attribute called "image_binary" which, upon setting, base64 encodes > the data, and when reading base64 decodes it. > > --MichaelThis is my RHTML code to upload image path from user: <p><label for="photo_picture">Picture</label><br/> <%= file_field ''photo'', ''photo'' %></p> Ruby code to save in Database (postgresql): def create @photo = Photo.new(params[:photo]) if @photo.save redirect_to :action => ''list'' else render :action => ''new'' end end Now i would like to know where i should add your code (mentioned above) Thanks Priya -- 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 -~----------~----~----~----~------~----~------~--~---