Its always recommended that you rename a file uploaded by users. If it is not done, there is a higher chance that a file of a similar name is already in your directory. To get a random name I have written the function. //Its a good idea to rename the file uploded by the users so as to avoid an overwrite to a file. //We need a random file name (to be generated on the fly) in case when we ask users to upload a file and ... //we do not want to have a clash between file names //this uses time stamp to have a unique name //this function uses Microtime to ensures that file name is unique. //this function can be called even in a for loop, then also it would return unique Name function randomFileName($month=0,$year=0,$random='random') { if(0==$month) $month=date('m'); if(0==$year) $year='RFILE'.date('Y'); if('random'==$random) $random=time();//to create uniqueness $date=date('MjGis');//to create uniqueness $microtime=microtime(true);//to cr...