Hi, been having problems with my image uploads with Safari and firefox,
i get it working with one, and it brakes in the other, and vice versa.
This problem manifests itself during an edit, if no image is selected on
the form.
I have the following code in my model:
def main_picture=(picture_field)
STDERR.puts picture_field
if picture_field != “”
File.open(“public/images/#{sanitize_filename(picture_field.original_filename)}”,
“w”) { |f| f.write(picture_field.read) }
end
end
if i excersise exactly the same code in both browsers, i get different
output for the line STDERR.puts picture_field
firefox gives me:
safari gives me a blank line. It also gives me the error:
undefined method `original_filename’ for “”:String
It seems that firefox correctly returns a picture object, but safari
returns a blank string.
Any ideas?