In my site visitors can upload photos, and of course I have the typical 
file type validation. I only allow files that are jpegs as seen in this 
script, but when I attempt to upload jpegs with that same file type, it 
gives me the error message I programmed if the content type is not 
image/jpeg, but in he same error message, the system tells you what file 
type it is if it isn''t image/jpeg, and my error read: "Only JPEG
files
are allowed. This file is image/jpeg ." I don''t get it. If the
system
confirmed it was an image/jpeg, then how come @file_type ==
''image/jpeg''
doesn''t return true, and return no error? What''s wrong with my
code?
 @file_type = params[:account][:picture].content_type
if @file_type == ''image/jpeg''
    # good
  else
    if @error == true
    @error_content += '' Furthermore, only JPEG files are allowed. This 
file is #{@file_type}.''
    else
    @error_content += "Only JPEG files are allowed. This file is 
#{@file_type}."
  end
    @error = true
  end
Thanks,
Ben
-- 
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
-~----------~----~----~----~------~----~------~--~---
Interesting... Somehow either Firefox or apache escaped/ added /r to the content_type.......It''s Solved. -- 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 -~----------~----~----~----~------~----~------~--~---
Dion Hewson
2006-Aug-22  14:46 UTC
[Rails] Re: Baffled on the most simple file upload issue
what was the fix? On 8/22/06, Ben <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Interesting... Somehow either Firefox or apache escaped/ added /r to the > content_type.......It''s Solved. > > -- > Posted via http://www.ruby-forum.com/. > > > >-- www.blogsaic.com search, post, blog --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Henning Kilset
2006-Aug-22  20:25 UTC
[Rails] Re: Baffled on the most simple file upload issue
Dion Hewson wrote:> what was the fix? >I''m guessing he typed @file_type = params[:account][:picture].content_type.*chomp* Instead of @file_type = params[:account][:picture].content_type> On 8/22/06, *Ben* <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > <mailto:rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> wrote: > > > Interesting... Somehow either Firefox or apache escaped/ added /r > to the > content_type.......It''s Solved. > > -- > 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 -~----------~----~----~----~------~----~------~--~---