After searching a lot and working endlessly on this problem I decided to post here.
I am passing a formdata with a filename variable to php using ajax. I then try to access the variable name so I can pass it to a second php that loads the name into the database. I am unable to pass or echo the data in php though. Can anyone help?

My javascript

```
function uploadFile() {
  var input = document.getElementById("picture");
  file = input.files[0];
  newFileName = elementHandle[9].val() + elementHandle[10].val() + elementHandle[11].val();
  console.log(newFileName);
  if (file != undefined) {
    formData = new FormData();

    if (!!file.type.match(/image.*/)) {
      formData.append("newFileName1", newFileName);
      $.ajax({
        url: "upload_file.php",
        type: "POST",
        data: formData,
        processData: false,
        contentType: false,
        success: function(data) {}
      });
    } else {
      alert('Not a valid image!');
    }
  } else {
    alert('Input something!');
  }
}

```

My php 

```
<?php
    $dir = "im_ges/";
    $file_name = $dir. $_REQUEST["newFileName1"].".jpg";
    echo $file_name;
    move_uploaded_file($_FILES["image"]["tmp_name"], $dir. $_POST ['newFileName1'].".jpg");
?>

```