
November 25th, 2003
01:45 AM
Im Jackson And I PWN StickThemePark.Com
Status: Offline!
Rename Uploaded file
Ok ive got a fileuploader and I expect that im gonna have a problem with people uploading files with the same name even though I made it so it would tell the user if theres a file with that name.
What I want to do is have $filename-$count.swf I was wondering how I can rename the file from just blah.swf to blah-13.swf on upload.
$filename would be the filename from the orginal file and $count would be how for how many uploads there been going up each time
Any ideas?
___________________
-=STP=- StickThemePark.Com

November 25th, 2003
01:50 AM
Neversidian
Status: Offline!
you can either scan the directory and see how many files you have, you can store the number in a text file or a mysql db just like a hit counter, but for the downloads, or if you dont want the numbers to be in order you can use a timestamp, the timestamp is the easiest but it puts a 10 digit number in the filename.
___________________
Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

November 25th, 2003
09:21 PM
Im Jackson And I PWN StickThemePark.Com
Status: Offline!
I already have a line that counts how many movies have been uploaded I just need to figure out how you rename a file on upload
___________________
-=STP=- StickThemePark.Com

November 25th, 2003
09:58 PM
Neverside Newbie
Status: Offline!
rename() perhaps? Search in the PHP documentation ext time for this kind of question.

November 26th, 2003
03:33 PM
Neversidian
Status: Offline!
well then when u save the filename just put the unique key at the beginning of it...
___________________
Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!