正确使用move_uploaded_file()

I used this tag to move my uploaded files to a directory, and it seems that it didn't worked as planed. This is what my code looks like:

$tmp = $_FILES['file']['tmp_name'];
$location = "/var/www/images/";

move_uploaded_file($tmp, "$location.$tmp");

Did I supplied the correct arguement? If not, what could be the answer to my problem?

Thank you in advance. :)

you must use $_FILES['file']['name'] while giving name to uploading file, try using like this

$tmp = $_FILES['file']['tmp_name'];
$name = $_FILES['file']['name'];
$location = "/var/www/images/";

move_uploaded_file($tmp, "$location.$name");

Try this, You need to use name instead of tmp_name

$filename = $_FILES['file']['name'];
move_uploaded_file($tmp, "$location.$filename");
$location = "/var/www/images/".$_FILES['file']['name'];

move_uploaded_file($_FILES['file']['tmp_name'], $location);