aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-08-16 05:12:20 -0700
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-08-16 05:12:20 -0700
commit5297b48df0d4b4136f0d74bf2dc0a3153d7cf31b (patch)
treee8172211570c4ab404d2477fc06a3315e011973c /guides/source
parent5c6e11d6b89444eefcb12e24d5419dadefdea1ba (diff)
parent92a03d888e0053962061fdfb1139c91e086bff0e (diff)
downloadrails-5297b48df0d4b4136f0d74bf2dc0a3153d7cf31b.tar.gz
rails-5297b48df0d4b4136f0d74bf2dc0a3153d7cf31b.tar.bz2
rails-5297b48df0d4b4136f0d74bf2dc0a3153d7cf31b.zip
Merge pull request #11910 from brendon/master
Use binary mode to write uploaded files [ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/form_helpers.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md
index 11e8db9e88..3a18fb81d8 100644
--- a/guides/source/form_helpers.md
+++ b/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