MongoDB, Carrierwave, GridFS and prevention of files' duplication
Posted
by
Arkan
on Stack Overflow
See other posts from Stack Overflow
or by Arkan
Published on 2010-12-28T13:49:53Z
Indexed on
2010/12/28
13:54 UTC
Read the original article
Hit count: 523
I am dealing with Mongoid, carrierwave and gridFS to store my uploads.
For example, I have a model Article, containing a file upload(a picture).
class Article
include Mongoid::Document
field :title, :type => String
field :content, :type => String
mount_uploader :asset, AssetUploader
end
But I would like to only store the file once, in the case where I'll upload many times the same file for differents articles.
I saw GridFS has a MD5 checksum.
What would be the best way to prevent duplication of identicals files ?
Thanks
© Stack Overflow or respective owner