I put together this code from my research. It's the file used to accept a file upload. Is this correct? I am attempting to upload to the page but it is failing. Not sure if the problem is on the server side (this script) or not, at this point. (This code is being used to accept camera shot uploads o smartphones and tablets. I'm using Cordova PhoneGap software.)

I'm uncertain of the line that goes: "/srv/www/uploads/" This is from an example online. Is /srv/ common to servers, or am I supposed to change it? My server reflects the /www/uploads/ part correctly.

Code:
<?php
define("UPLOAD_DIR", "/srv/www/uploads/"); // UNCERTAIN OF THIS PART: /SRV/

print_r($_FILES);

$allowed_exts = array("gif", "jpeg", "jpg", "png");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/png"))
&& ($_FILES["file"]["size"] < 20000)
&& in_array($extension, $allowed_exts)) {
  if ($_FILES["file"]["error"] > 0) { ?>
document.getElementById('camera_status').innerHTML = "Return Code: "
<?php . $_FILES["file"]["error"] . ?>
document.getElementById('camera_status').innerHTML = "<br/>";
<?php
  }
  else {
  ?>
  
document.getElementById('camera_status').innerHTML = "Upload: "
<?php . $_FILES["file"]["name"] . ?>
document.getElementById('camera_status').innerHTML =+ "<br/>Type: "
<?php . $_FILES["file"]["type"] . ?>
document.getElementById('camera_status').innerHTML =+ "<br/>Size: "
<?php . ($_FILES["file"]["size"] / 2048) . ?>
document.getElementById('camera_status').innerHTML =+ " kB<br/>Temp file: "
<?php . $_FILES["file"]["tmp_name"] . ?>
document.getElementById('camera_status').innerHTML =+ "<br/>";
<?php
    if (file_exists(UPLOAD_DIR . $_FILES["file"]["name"])) { ?>
document.getElementById('camera_status').innerHTML =+ <?php $_FILES["file"]["name"] . ?>
document.getElementById('camera_status').innerHTML =+ " already exists. ";
<?php
    }
    else {
      var now = new Date();
      $new_image_name = now + ".jpg";
      move_uploaded_file($_FILES["file"]["tmp_name"], UPLOAD_DIR . $new_image_name);
    }
  }
}
else { ?>
document.getElementById('camera_status').innerHTML =+ "Invalid file";
<?php 
}
?>