Change Upload Location

Hi,

I have a code which uploads an image but I cant seem to work out how to change the upload the location.

I am looking for an image to be uploaded to www.website.com/userimages/logo.php

I have tried a few options but I just cant get it upload to a designated location.

 else {
        // Set the direntory for where to upload it, use the member id to hit their folder
        // Upload the file
	    /*if(isset($_GET['id'])){
		if (!is_dir('memberFiles/'.$id.'/images/')) { //if memberFiles folder does not exist
 			mkdir('memberFiles/'.$id.'/images/'); //make the folder
		}*/
		if (!is_dir('images/')) { //if memberFiles folder does not exist
 			mkdir('images/'); //make the folder
		}
	        $target_path = 'images/'; //set targetpath
}
		//adjust target path to create new file name which include $id and current date and original filename
		$ref = "-". gmdate('jmyhis') ."-". basename( $_FILES['uploadLogo']['name']);
		$target_path .= $ref;
		$filename = basename($_FILES['uploadLogo']['name']);
		$date =	gmdate('j-m-y h:i:s');

move_uploaded_files?

Yes!

move_uploaded_file()

The file is not at $_FILES[“file”][“name”]

but at $_FILES[“file”][“tmp_name”] :cool:

Hi,

Im a bit lost as to what you mean tbh. I have this. Is this target_path I need to change?

		else {
if(move_uploaded_file($_FILES['uploadLogo']['tmp_name'], $target_path)) {
		mysql_query("UPDATE users SET logo1='$ref' WHERE id='$myID'");
        echo "Your image ".$filename." has been uploaded";
} else {
    	echo "There was an error uploading the logo file, please try again!";
}
}
}