dude , that some jurasick code, if from 2007?

wow, what the guy is down is checking the myme
type<http://www.iana.org/assignments/media-types/>on the create
action, today that is done in a validation in the model.

params[:photo]['photo']

is something like this

parameter => {:item=>{:name=>"blah blah", :description=> " more blah
blah"},:photo =>{:photo=>[ bunch of data about the file ] }   }

at the end in that bunch of that about the file the browser pases  the media
type, that is somethie the browser does and they can be

application <http://www.iana.org/assignments/media-types/application/>

audio <http://www.iana.org/assignments/media-types/audio/>

example <http://www.iana.org/assignments/media-types/examples/>

image <http://www.iana.org/assignments/media-types/image/>

message <http://www.iana.org/assignments/media-types/message/>

model <http://www.iana.org/assignments/media-types/model/>

multipart <http://www.iana.org/assignments/media-types/multipart/>

text <http://www.iana.org/assignments/media-types/text/>
video <http://www.iana.org/assignments/media-types/video/>

plus the images can be jpg or tiff

with    .content_type =~ /^image/

he is saying grab the media type see if it starts with image, as the browser
pases somthing like this

image/jpg

or

image/tiff

so with

unless params[:photo]['photo'].content_type =~ /^image/
flash[:error] =" that is not an image file "
render :action => 'new'
end

he is checking from the params hash if the file uploaded has a media type of
image. if not render new

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to