Use binary mode to write uploaded files

See: http://stackoverflow.com/a/4988984/129798 for an explanation for why this is required for Ruby 1.9.