it should be like:
do {
$_random = rand(1, 1000000);
$target_file = $upload_dir . $_random . basename($_FILES['file' . $i]['name']);
}while(file_exists($target_file);
//now at this point $target_file is unique and u can upload it safely
If you need to give the realfile name, one the user has uploaded (making SEO coool)
then it can be done by putting the realfilename in the database to this $target_file and just rewrite throught .htaccess while accessing the file, adding onemore parameter imageid is required to make the url for each image unique.
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
Offline 57 posts
since Jun 2007