Php - How to NOT Overwrite a File?

This is my current php script


$fp = fopen('image.jpeg', 'wb');
fwrite($fp, $GLOBALS['HTTP_RAW_POST_DATA']);
fclose($fp);

I’m using my flash file to send some data to my php file to create and save a .jpeg on my server under the name of “image.jpeg”.

If I want to create more the one image, this script overwrites my current image.

How would I not overwrite it, but instead add a number to the end of the image’s name, ex: image.jpeg, image-2.jpeg, image-3.jpeg, you get the point.

This is probobly pretty simple, I’m just somewhat of a noobie at php.

Thanks!