Thanks for the code, however I was needing a script, where basically the user has to enter his name, choose file, file comments if required and upload and I want to generate a 10 digit unique code everytime, which makes it simple for the user to download the file. I am posting the below code, can you help me out:
PHP Code:
<?
//set the random id length
$random_id_length = 10;
//generate a random id encrypt it and store it in $rnd_id
$rnd_id = crypt(uniqid(rand(),1));
//to remove any slashes that might have come
$rnd_id = strip_tags(stripslashes($rnd_id));
//Removing any . or / and reversing the string
$rnd_id = str_replace(".","",$rnd_id);
$rnd_id = strrev(str_replace("/","",$rnd_id));
//finally I take the first 10 characters from the $rnd_id
$rnd_id = substr($rnd_id,0,$random_id_length);
echo "Random Id: $rnd_id";
?>
Bookmarks