Skip to content

Instantly share code, notes, and snippets.

@yiquncode
Created December 17, 2010 04:25
Show Gist options
  • Save yiquncode/744485 to your computer and use it in GitHub Desktop.
Save yiquncode/744485 to your computer and use it in GitHub Desktop.
return nil if uploaded_file.nil?
extension = File.extname(uploaded_file.original_filename).downcase
@queued_for_write[:original] = to_tempfile(uploaded_file)
instance_write(:file_name, "#{Time.now.strftime("%Y%m%d%H%M%S")}#{rand(1000)}#{extension}")
instance_write(:content_type, uploaded_file.content_type.to_s.strip)
instance_write(:file_size, uploaded_file.size.to_i)
instance_write(:fingerprint, generate_fingerprint(uploaded_file))
instance_write(:updated_at, Time.now)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment