Tips 'n Tricks

Bug in Safari 3 beta: hidden file fields don't get submitted

I've just wasted several hours due to what turned out to be a bug in the current Safari 3 beta (on OSX Tiger). If you have a form with some DIVs set to display:none;, any file fields that are in the hidden DIVs do not get submitted along with the rest of the data, whereas text fields are submitted. This inconsistency does not exist in Firefox 2 - it submits all of the available fields. Bad Safari, bad!


Reminder - rails forms with file uploads

Just a quick reminder for myself: if you're doing a form that is uploading files, remember to add :multipart => true to the form tag, e.g.:
< % form_for(:product, :url => products_path(@product), :html => {:multipart => true, :method => :put }) do |f| %>

< %= f.file_field :photo %>

< % end %>



Subscribe to Tips &#039;n Tricks