Hi, I''m trying to get content_type value for uploaded file, but it always return to me application/octet-stream even if it is video.avi or file.rb or any other music.mp3 is there anything special I need to do in my rails application? //jamal -- 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 15, 3:24 am, Jamal Soueidan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > I''m trying to get content_type value for uploaded file, but it always > return to me > > application/octet-stream > > even if it is video.avi or file.rb or any other music.mp3 > > is there anything special I need to do in my rails application? > > //jamal > -- > Posted viahttp://www.ruby-forum.com/.you could try one fo these http://blog.amodernfable.com/2006/11/12/file-upload-content-types-on-ruby-on-rails-one-liner/ http://www.db75.com/new_blog/?p=289 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I just tried both of them out :) logger.info file_data.content_type.chomp output => application/octet-stream the same as before.. logger.info file_data.content_type.to_s.strip! output => "" empty... -- 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 15 Nov 2007, at 13:21, gene tani wrote:>> I''m trying to get content_type value for uploaded file, but it always >> return to me >> >> application/octet-stream >> >> even if it is video.avi or file.rb or any other music.mp3 >> >> is there anything special I need to do in my rails application? >> >> //jamal >> -- >> Posted viahttp://www.ruby-forum.com/. > > you could try one fo these > > http://blog.amodernfable.com/2006/11/12/file-upload-content-types- > on-ruby-on-rails-one-liner/ > http://www.db75.com/new_blog/?p=289These two pages don''t deal with determining the filetype for application-octet stream files, the content type just isn''t passed in on upload (probably because you''re using a Flash uploader). You can use mimetype_fu to determine the filetype, it works perfectly. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you very much, it works now :) Since you guessed that the problem I''m facing is with Flash, you may know how to validate the file before uploading it to the server? when flash uploading progress is on 100% it execute the action method. -- 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 -~----------~----~----~----~------~----~------~--~---