Upload -md5 hash and upload unique file only once

Upload -md5 hash and upload unique file only once

paintitblackpaintitblack Posts: 60Questions: 20Answers: 0

Hi,

with the upload solution (https://editor.datatables.net/examples/advanced/upload.html) it is possible to upload the same file several times. Why don't you store the md5 hash of each file and if the file already exists that you don't upload the file. Instead it would be better to just create the users_files entry. If you delete a file you must also check if the file is used twice.

Did you alread think about this kind of solution? (it would reduce the required space)

I already tried to just store the md5 hash with the modified Upload.php but I failed.

Could anybody help?

Kind regards

pib

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    The built in library doesn't do that as it tries to cater for simple implementation with no fundamental requirements on the database structure (just like the rest of Editor). Requiring that there be a hash field would break that goal.

    That said, I agree. Actually, moreover, what I would like to see is a "gallery" plug-in, so it is up to the end user to select images from those that have already been uploaded. If they wanted to upload the same image again, they could (perhaps with a warning). That is a longer term goal for Editor :).

    Allan

This discussion has been closed.