Displaying 1 result from an estimated 1 matches for "newfile_field".
2006 May 29
3
File.size() on Uploaded Images Fail
...am checking the file size of an uploaded file and storing it in a filesize
column. It will work just fine when the user uploads any files other than
images (jpg,png,gif).
Word, Excel, Powerpoint, .zip and more all work fine.
This is my model asset.rb that handles the file upload.
def newfile=(newfile_field)
self.filename = base_part_of(newfile_field.original_filename)
self.filetype = newfile_field.content_type.chomp
self.filesize = File.size(newfile_field) ### It fails on this line for
images...
end
The error I get is: "can''t convert StringIO into String"
I''...