Welcome Guest, Not a member yet? Register   Sign In
Is File Upload class creates unique file name when encrypt_name set true?
#5

(This post was last modified: 10-30-2018, 11:09 AM by jreklund.)

Personally I'm using a UUID version 4 generator for my file names and all ID (instead of auto increment).

PHP Code:
if ( ! function_exists('UUIDv4'))
{
    
/**
     * Generates a random UUID using the secure RNG.
     *
     * Returns Version 4 UUID format: xxxxxxxx-xxxx-4xxx-Yxxx-xxxxxxxxxxxx where x is
     * any random hex digit and Y is a random choice from 8, 9, a, or b.
     *
     * @return string the UUID
     */
    
function UUIDv4()
    {
        
$bytes random_bytes(16);
        
$bytes[6] = chr((ord($bytes[6]) & 0x0f) | 0x40);
        
$bytes[8] = chr((ord($bytes[8]) & 0x3f) | 0x80);
        
$uuid vsprintf('%s%s-%s-%s-%s-%s%s%s'str_split(bin2hex($bytes), 4));
        return 
$uuid;
    }


https://en.wikipedia.org/wiki/Universall...Collisions
Reply


Messages In This Thread
RE: Is File Upload class creates unique file name when encrypt_name set true? - by jreklund - 10-30-2018, 10:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB