新手问题 怎么获取上传文件的大小 undefined method `length'

suntianxiang · October 20, 2014 · Last by heylonj replied at October 20, 2014 · 1433 hits

我的 action def updeal file = params["upfile"] detail = "type" + file.content_type.strip if file.length > 1 File.open('a.txt',"wb+") do |f| f.write(file.read) end end render(:text =>detail) end 为啥不能用 length 方法?还有啥方法获得吗

params[:upfile].size or File.size("#{file_name}")

You need to Sign in before reply, if you don't have an account, please Sign up first.