duplicate uploads - was wanting to know how to store a file on a bucket only once (according to some customised logic) - with multiple records pointing to it that same bucket object.
was seeking some advice on a possible workflow:
Users upload photos/files directly to a bucket.
e.g. Freddie uploads files & photos of his Wembley tour.
The next day, Brian uploads the very same/exact photos.
I still want Brian to create those active model records, but I would like those records to point to the existing bucket objects which were created when Freddie uploaded his files and photos.
The problem I’m facing is that 50 users may upload the same 200 photos. That’s 10,000 bucket objects when only 200 is necessary. I would want to minimise unnecessary duplication in the bucket, but I would still want them to create those records.
photo.rb - ActiveRecord model
I am currently storing the SHA1 of a file/image that has been uploaded.
If I were to do validations based on SHA1, then the record would fail to save?! I do not want the record to fail from saving, but simply for it to point to existing objects in the bucket.
Do you folks have some general advice on how the above work flow can be accomplished?
I hope I’m making some sense.
Chrs for any pointers.