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:
parent
5c6e11d6b8
commit
92a03d888e
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue