Forum Moderators: coopster

Message Too Old, No Replies

File rename while uploading if exists in filename[n].ext

rename the new file if file alredy exists in the filename[n].ext format

         

mp3mechanical

8:59 am on Jun 25, 2007 (gmt 0)

10+ Year Member



hello all..
i am making file manager for my site..
and i need a function by which i can change filename if the same file is already on the server.

initially i tried to change the filename by adding preifx "new_" to original filename but it gives problem while alphabatically listing of file.

so i want to rename file by adding suffix in the filename( somefile.withdots.filename.extension to somefile.withdots.filename[1].extension )...but i have not much idea with strings so not able to figure it out...and i also dont want to involve 2step process of storing file into temp & then rename it...

can anybody help me for making a function for renaming uploaded file (ie. somefile.filename.ext to somefile.filename[1].ext )

any help will be appreciated..thanks.

joelgreen

11:34 am on Jun 25, 2007 (gmt 0)

10+ Year Member



Isn't this working?

[ua.php.net...]