# PHP - rename uploaded files to sequential number

**URL:** <https://forum.kirupa.com/t/php-rename-uploaded-files-to-sequential-number/290444>\
**Category:** programming\
**Created:** [June 15, 2009, 5:04am UTC](https://forum.kirupa.com/t/php-rename-uploaded-files-to-sequential-number/290444 "2009-06-15T05:04:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robmausser](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@robmausser](https://forum.kirupa.com/u/robmausser)\
**Post date:** [June 15, 2009, 5:04am UTC](https://forum.kirupa.com/t/php-rename-uploaded-files-to-sequential-number/290444/1 "2009-06-15T05:04:26Z")

</div>

Hi.

I have a PHP form that lets people upload .wav files to my site.

I need the files to be renamed from what they origionally were (say, bass.wav, drums.wav) to a sequential number.

So the first file uploaded will be named 1.wav, then 2.wav, then 3.wav, then 4.wav. etc etc.

There are tutorials for renaming to random numbers but not sequential.

How could this be done?

Thanks
