I'm using [promosis](https://github.com/promosis/file-upload-with-preview) in combination with JS Formdata and AJAX to send the file over to the server. But i'm having problems with storing it. Since `move_uploaded_file()` fails with an array, and using the filename results in no error but it still fails.

AjaxCall: 

```
 let fd = new FormData();
    fd.append('id', id);
    fd.append('name', name);
    fd.append('caption', caption);
    if( upload.cachedFileArray[0] !== null || typeof upload.cachedFileArray !== "undefined"){
        alert('defined...');
        alert(upload.cachedFileArray[0]);
        fd.append('file', upload.cachedFileArray[0]);
    } else {
        alert(upload.cachedFileArray[0]);
        alert('U heeft nog geen afbeelding toegevoegd!');
    }
    $.ajax({
        url: '/SaveSlide',
        type: 'POST',
        processData: false,
        contentType: false,
        beforeSend: function (xhr) {
            const token = jQuery('meta[name="csrf_token"]').attr('content');
            if (token) {
                return xhr.setRequestHeader('X-CSRF-TOKEN', token);
            }
        },
        data: fd,
        success: function (data) {
            alert(data);

        }
    });

```

PHP:

```
 public function SaveSlide(){
    if($_FILES['file']){
        //echo json_encode($_POST['id'] . $_POST ['name'] .$_POST['caption'] . var_dump($_FILES ['file']));

        if($_FILES['file']['type'] === "image/jpeg") {
            if (move_uploaded_file($_FILES['file'], asset('assets/img/'))) {
                echo json_encode('Uploaded!');
            } else {
                echo json_encode('Not uploaded :(!');
            }
        }
        //$html = $this->slideController->EditSlide($data);
    }
}

```

The AJAX Call does send the data over, since I can echo the object array back and show it. 

Array is structured like:
`name:` `lastmodified:` `lastmodifieddate:` `WebkitRelativePath:` `size:` `type:` `slice: function(){}` 

How can I store the uploaded file/image to the server?