Uploaded files via API always ends up corrupted

So when I try to upload a file using the API, it always ends up with said file corrupted.

This is the code I use, (also tried manually make a POST request with multipart, same result)

$media = (new \Xibo\OAuth2\Client\Entity\XiboLibrary($entityProvider))->create($fileName, $filePath);

From what I have seen, it creates a registry on the database, but the file is not saved on the server.

It doesn’t return any error, it’s just that the server doesn’t keep it in its file system or something.

    [url:Xibo\OAuth2\Client\Entity\XiboLibrary:private] => /library
    [deleteOldRevisions] => 
    [duration] => 10
    [error] => 
    [fileName] => 
    [fileSize] => 3460
    [md5] => c06c24577bde4949c8f4bd5d8239d4b0
    [mediaId] => 36
    [mediaType] => image
    [name] => API upload test
    [ownerId] => 
    [parentId] => 
    [retired] => 0
    [storedAs] => 36.png
    [tags] => 
    [updateInLayouts] => 

Okay, so I have a custom folder set for library, and the file, ends up in /api/customLibrary instead of /customLibrary, what do I do? :upside_down_face: