Welcome Guest, Not a member yet? Register   Sign In
How to avoid duplicate uploaded file?

Hi guys

I want to avoid duplicate uploaded file names.
But what CI did was it duplicate the name and extended
the name with numbers like this below,

and so on...

How to avoid this duplicate files but instead just replace the
existing the same file with new file?

Thanks in advanced.


[eluser]Abel A.[/eluser]
Get the hash value of the file and compare it to other hashes. Each file has a unique hash and if they're identical files, then they will have the same hash value.

It is not optimal to check every single file's hash value from the hdd, but instead have the hash values stored in the database.

Use md5 to get the hash value.


According to the userguide you need that config item:
$config['overwrite'] = TRUE;

Theme © iAndrew 2016 - Forum software by © MyBB