Well, here goes...
Way 1:
use something like this to count the files in the folder, and then you have a filename.
$filecounter = 0;
$folder = opendir("files");
while($file = readdir($folder)) {
$filecounter = $filecounter + 1;
}
}
so if there are 10 files in the folder, the filename of the newly uploaded file would be filename_11
Way 2:
This is really to check to see if the file name is already taken or not. So...
$filename = '/path/to/foo.txt';
if (file_exists($filename)) {
print "The file $filename exists";
} else {
print "The file $filename does not exist";
}
should get you a result, on which your script can save, or rename and save the file.
How's that?
Hope this helps...
🙂