Here we have a scenario to encode file name and want to decode it while retrieving.
if i encode it with md5 i cant decode it because it is one way hashing and if i encode it with ‘base64_encode’ then if two files with same name will cause conflict to my data while retrieving.
So i want to know if there in any unique encoding function in PHP to encode and later to decode.
Thanks in advance!!!!
You could use base64_encode and prepend a unique identifier like this:
And decode it like this:
This would basically give you an encoded string for the filename that’s unique and can be reversed to the filename.