Great module! Any chance it could be enhanced with some kind of configuration option to help prevent duplicate files from being uploaded by a user?

Example:
1. User 1 uploads photo
2. Filehash creates and stores the hash of the file contents
3. User 2 should browse for existing photos to reuse (media module) but is lazy or doesn't know how so they attempt to upload the same file as User 1.
4. User 2 is initially prevented from uploading file, provided feedback in the form of a Drupal error message perhaps with information about the identical file that was already uploaded and given the option to use the same file already uploaded by User 1 or can override and upload the file again.

Alternatively, if this module could store the filehash in a field, the field validation module or clientside validation module (or others) could be leveraged to provide the uniqueness check and feedback. I attempted to accomplish this by using the token provided by Filehash and inserting it into a text field using the "default value", but Drupal 7 doesn't support using tokens as the default value.

Thanks!

Comments

timwood’s picture

Sorry, I should have looked at more recent Git commits for anything new. Of course I did this AFTER submitting this issue and found this commit:
http://drupalcode.org/project/filehash.git/commit/a312c46

Does simplified version of what I described, NICE!

I will test the dev version.

timwood’s picture

Awesome! The dev version provided the basic functionality for this feature request. It could certainly be improved to provide a better user experience and to perhaps enable at the file field level instead of globally.

If the module maintainer and others are interested my organization may be able to provide a patch.

Thoughts?

mfb’s picture

Hi Tim, field-level settings and validation would be excellent, if you are able to develop a patch please submit it here!

mfb’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Issue summary: View changes

Moving feature request to current version.

mfb’s picture

mfb’s picture

Version: 8.x-1.x-dev » 2.x-dev
Status: Active » Needs review

I have work underway on this in the 2.x branch - dedupe is now configurable at the upload field settings (still needs test coverage).

  • mfb committed 0485c1d on 2.x
    Issue #1910372 by mfb: Add functionality to help prevent upload of...
mfb’s picture

Status: Needs review » Fixed

Ok got field-level settings working and added a test

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.