Here is my code:
move_uploaded_file ($_FILES['$profile_photo'] ['tmp_name'],
Next I'd like to rename the file to the usernames + the extension. The user can only have one photo which either has to be .gif or .jpg. So I'd like to overwrite or delete the old photo.
So I know I can use rename but
1) how do i extract the extension from the original name?
(username is contained in variable $username)
say the user with username: sara15 uploads lisa456.jpg. Id like to copy lisa456.jpg to /pics then rename it to sara15.jpg after making sure sara15.gif doesn't exist and overwriting sara15.jpg if it exists.
Any help would be much appreciated :)