hi, i''m sure some of you had come across this problem before, but i was unable to find the answer after spending quite some time searching. i have a basic file uploader, code similar to rails recipe (or rails manual). problem occurs when i try to upload files (images) greater than 500KB. the largest file i could upload was 493KB and i''ve uploaded a bunch files under 490KB and they all worked. the smallest file which i failed to upload is 500KB so i guess that''s where the "limit" is. my data field in mysql is set to mediumblob, inevitably, i tried changing it to longblob which didn''t work. i''m running the webrick server. Any help would be greatly appreciated... thx -- 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 -~----------~----~----~----~------~----~------~--~---
mike yang wrote:> hi, > > i''m sure some of you had come across this problem before, but i was > unable to find the answer after spending quite some time searching. > > i have a basic file uploader, code similar to rails recipe (or rails > manual). > > problem occurs when i try to upload files (images) greater than 500KB. > the largest file i could upload was 493KB and i''ve uploaded a bunch > files under 490KB and they all worked. the smallest file which i failed > to upload is 500KB so i guess that''s where the "limit" is. > > my data field in mysql is set to mediumblob, inevitably, i tried > changing it to longblob which didn''t work. > > i''m running the webrick server. > > Any help would be greatly appreciated... > > thxHi I am aware that this post is quite old. But I went through the same scenario as you have described above by testing different file sizes around 500KB. The only relevant search result I found was this thread with no replies. The error from rails was ActiveRecord::StatementInvalid and not much more info to go on besides the fact that the error was thrown in the MySQL adapter. After looking in my development.log I could actually read the error message that the MySQL server had returned. The problem was that the MySQL server by default did not allow incoming packets to be larger than 500KB. The solution is to change the "max_allowed_packet" variable in your MySQL server. Which is described on this link: http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html I simply created (on FreeBSD) a /etc/my.cnf and added the following two lines and then restarted MySQL: [mysqld] max_allowed_packet=16M A tried to upload a file ~14 MB and I got the same error as before. Make sure you have this variable set with a marginal. Hope that helped fluff -- 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 -~----------~----~----~----~------~----~------~--~---