Permalink
Browse files

Merge pull request #11910 from brendon/master

Use binary mode to write uploaded files [ci skip]
  • Loading branch information...
1 parent 166b235 commit b3c263fc44f3af08bf64efafef1206284ddf2622 @carlosantoniodasilva carlosantoniodasilva committed Aug 16, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 guides/source/form_helpers.md
@@ -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

0 comments on commit b3c263f

Please sign in to comment.