Ton*_*ony 1 file-io ruby-on-rails
我有
f = File.new(contacts_file_path, "wb")
f.write params[:uploaded_file].read
f.close
Run Code Online (Sandbox Code Playgroud)
我想要
begin
f = File.new(contacts_file_path, "wb")
f.write params[:uploaded_file].read
rescue
#error
ensure
if f.open? then f.close end
end
Run Code Online (Sandbox Code Playgroud)
但是打开吗?不是一个功能,我找不到任何api文档.有任何想法吗?
| 归档时间: |
|
| 查看次数: |
1144 次 |
| 最近记录: |