I want to get the size of an uploaded file that is saved in the
database. Can you help me?
In the edit view formular there is:
In the Attachment-model is:
self.name = base_part_of(attachment_field.original_filename)
self.content_type = attachment_field.content_type.chomp
#self.size = attachment_field.file.size
self.data = attachment_field.read
def base_part_of file_name
name = File.basename(file_name)
In the project controller is (Attachments belong to projects):
Is it possible to get the filesize already before storing the data or do
I have to get it with a special function in the show view, where I want
to display it?