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
For multiple files download, I add some lines from SananTheBest as following. Actually, The reason files can not upload because the files name are same even using date as mentioned in his pervious post. (Thanks you)
protected function generate_unique_filename($filename = "")
{
$extension = "";
if ( $filename != "" )
{
$extension = pathinfo($filename , PATHINFO_EXTENSION);
if ( $extension != "" )
{
$extension = "." . $extension;
}
}
//$filenamegen = date('ymdHis').generateRandomString();
$characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$charactersLength = strlen($characters);
$randomString = "";
for ($i = 0; $i < 5 ; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
//$filenamerandom=$filename.".jpg";
//return md5(date('Y-m-d H:i:s:u')). $extension;
return date('ymdHis').$randomString . $extension ;
}