maniaplanet / dedicated-server-api

PHP library for interacting with the ManiaPlanet Dedicated Server XML-RPC API
GNU Lesser General Public License v3.0
13 stars 8 forks source link

writeFile() results in Request Too Large error #31

Open Chris92de opened 5 years ago

Chris92de commented 5 years ago

Trying to upload a map via a simple script similar to this always results in "Request Too Large" errors when map size exceeds certain value. public function TryWriteFile(){ $conn = $this->connect(); $filename = "OTHERWORLD.Map.Gbx"; $file = file_get_contents($filename); try{ $conn->writeFile($filename, base64_encode($file)); $conn->addmap($filename); } catch (Exception $ex){ echo $ex->getMessage(); } }

Map used: https://tm.mania-exchange.com/tracks/136892/otherworld This map file is roughly 1.4MB, but the strlen of the final XML call ends up being 2505340, which is larger than the MAX_REQUEST_SIZE - 8 (0x200000 - 8)

Even if I workaround the error by increasing the const in GbxRemote.php, the linux dedicated server then says it can't write the file, even though directory permissions are 777 and server is ran as root (just to test).

Not sure where the exact error here is, but I'm assuming it's in both the library and the Dedicated Server itself.

Chris92de commented 5 years ago

Disregard, wasn't using "dev-master" branch in composer.json, but I'm still getting the couldn't write file /path/to/UserData/Maps error now.