1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use binary mode to write uploaded files [ci skip] See: http://stackoverflow.com/a/4988984/129798 for an explanation for why this is required for Ruby 1.9.

This commit is contained in:
Brendon Muir 2013-08-16 14:10:31 +12:00
parent 5c6e11d6b8
commit 92a03d888e

View file

@ -605,7 +605,7 @@ The object in the `params` hash is an instance of a subclass of IO. Depending on
```ruby
def upload
uploaded_io = params[:person][:picture]
File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'w') do |file|
File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|
file.write(uploaded_io.read)
end
end