I\'m using the Blueimp jQuery file upload tool. I\'d like to completely rename the files as they\'re uploaded. Since photos are being added to a unique directory based on the us
Why not trying uniqid()
to generate an unique name?
protected function generate_unique_filename( $filename = "" )
{
$extension = "";
if ( $filename != "" )
{
$extension = pathinfo( $filename, PATHINFO_EXTENSION );
if ( $extension != "" )
{
$extension = "." . $extension;
}
}
return md5( uniqid() ) . $extension;
//or simply return uniqid() . $extension;
}