I have a file uploader script and i'm wondering how to get it to rename the file for me eg. first file is renamed to 0001 then 0002 and so on.
See http://uk2.php.net/copy - just do your string manipulation on $newfile and rename it accordingly.
Actually you can just name the uploaded file before writing it out. Writing it out and then copying it to a new name creates avoidable overhead. Plus copy leaves the old behind and would require a call to unlink later. Anywho, when you write the file out, just create any name you want. You want the files numbered. However, we need to know what number to start at each time the script is called. If we don't know, we will always start at 0001 and overwrite the previous uploads. So, where are you storing the files? I'm asuming the file system. So you need to store a temp file with the current number to assign that is readable and writable to update. Or, do some sort of directory read, read the number in the file name of all the uploaded files that exist, then go one higher. A array function could probably do that.
You can play around here... copy ($_FILES['file_input']['tmp_name'], $upload_path.$file_name); you can specify the names for $upload_path (it will be folder where file will be uploaded) and $file_name, the name of the file you want... I guess it should work Deep