You can use this
function getfilename(){
mt_srand((double)microtime()*10000);
$token=mt_rand(1, mt_getrandmax());
$uid=uniqid(md5($token),true);
if($uid!=false && $uid!='' && $uid !=NULL){ return $filename =sha1($uid);}
}
//create file name
$filename=getfilename();
$filename = substr($filename, 0, 10);
The above code uses the current system time to generate the File Name and also uses mt_rand and MD5 so as to create a unique file name every time the code is run. The final filename is 10 characters, and you can adjust it to whatever number of characters you want.