Your comments

Well I figured it out!

So I was actually using a PUT request as mentionned in the doc:

curl_setopt($c, CURLOPT_CUSTOMREQUEST, "PUT");

I replaced this line by this one in order to make a POST request and it worked:

curl_setopt($c, CURLOPT_POST, 1);

Here is a working example using PHP cURL. Maybe it could help someone:

public function uploadFile($access_token, $username, $filename, $cfile)
        // header
        $headr = [];
        $headr[0] = 'Content-Type: multipart/form-data';
        $headr[1] = 'Authorization: Bearer '.$access_token;
        $headr[2] = 'Content-Disposition: name="file"; filename="'.$filename.'"';
        $c = curl_init();
        curl_setopt($c, CURLOPT_URL, 'http://localhost/filerun/api.php/files/upload/?path=/ROOT/HOME/users/'.$username.'/'.$filename);
        curl_setopt($c, CURLOPT_HTTPHEADER, $headr);
        curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($c, CURLOPT_POST, 1);
        curl_setopt($c, CURLOPT_POSTFIELDS, [
            'file' => $cfile,
        curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
        $resp = curl_exec($c);

Thanks Vlad for "putting" me on the correct track!

For example, I uploaded a file containing this line of text:

Ceci est un fichier .txt de test

After uploading it via curl, it now shows this:

Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain
Ceci est un fichier .txt de test

If I send a pdf or another type of file I receive the same response:

    "success": true,
    "error": false,
    "data": []

In any case the file uploaded appears in filerun but images can't be opened and texts contains extra information. Only .pdf are opened correctly.

If I drag and drop those same files directly into the filerun interface, it works fine.


Is there a way to update filerun on localhost?