# Safari and firefox return different objects from a form

**URL:** <https://www.ruby-forum.com/t/safari-and-firefox-return-different-objects-from-a-form/87259>\
**Category:** Rails\
**Created:** [March 1, 2007, 9:38am UTC](https://www.ruby-forum.com/t/safari-and-firefox-return-different-objects-from-a-form/87259 "2007-03-01T09:38:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@jon](https://www.ruby-forum.com/u/jon)\
**Post date:** [March 1, 2007, 9:38am UTC](https://www.ruby-forum.com/t/safari-and-firefox-return-different-objects-from-a-form/87259/1 "2007-03-01T09:38:15Z")

</div>

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:

#StringIO:0x256860c

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?
