So I've followed this link http://www.w3schools.com/php/php_file_upload.asp to make a photo uploading capability but rather than it saying that the file has already been uploaded when there is another file of the same name, how would i just make it change the file name to something else that hasn't been used before.
in other words, if there is another photo of the same name I still want it to upload but I don't want it to overwrite the existing one.
I basicaly want to replace this with something else to do that
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
so that its something like this
// Check if file already exists
if (file_exists($target_file)) {
"do something to change file name"
$uploadOk = 1;
UPDATE: I got it to work. I just made it so that it renames every image to a unique id like stated bellow. thanks
also in that suggestion it should be this
$newTarget_file = $target_dir . uniqid() . "." . end($target_file);