V8-archive: Wrong max file size for upload

Created on 17 Jan 2019  Â·  5Comments  Â·  Source: directus/v8-archive

Bug Report

Steps to Reproduce

âš  I'm not sure how to reproduce this bug because I think it is mainly due to the environment.

Here are some details about the environment:

  • Server API: FPM/FastCGI
  • post_max_size: 96M
  • upload_max_filesize: 62M

Feel free to ask if you need more details, I don't know what can be useful to understand the issue.

  1. Go to any form with a file input
  2. See wrong max file size

image

Expected Behavior

Max file size should be 62 MB.

Actual Behavior

Max file size is 2 MB.

Other Context & Screenshots

I made it work by just changing one line of code:

--- a/src/endpoints/Home.php
+++ b/src/endpoints/Home.php
@@ -12,7 +12,7 @@ class Home extends Route
     public function __invoke(Request $request, Response $response)
     {
         $service = new ServerService($this->container);
-        $responseData = $service->findAllInfo();
+        $responseData = $service->findAllInfo(false);

         return $this->responseWithData($request, $response, $responseData);
     }
bug

Most helpful comment

Hey @sebj54, I fixed this by getting configuration values from runtime by default.

All 5 comments

Where did you change the post_max_size, and upload_max_filesize value? Ideally this endpoint (/) should get you the php.ini value instead of the configured value. To get the configured value each project endpoint should use it.

Now I don't know if getting the php.ini value will be really useful.

Okay, that explains the boolean parameter so! I didn't understand very its usefulness, that's why I didn't say "it's the solution" but "I made it work" 😊

Now, what could I provide you so we can understand what is wrong here?
I don't really know how this hosting is handled (except that it works with Plesk), but I got these values from phpinfo():

  • post_max_size: 96M
  • upload_max_filesize: 62M

I'd like to share the full phpinfo() output with you but I'm afraid it won't be "safe" as I am not the owner of this hosting.

That's okay do not share sensitive data. I know it will fix it, I don't know if we should ignore the php.ini value (which is the value you get when it's true) or make the app to use the /[project]/ endpoint which actually uses $responseData = $service->findAllInfo(false);.

In really I am do not see any useful solution to know the "global" value. Same as in phpinfo, it gives you two values the one in php.ini and the one while on runtime.

Actually, this should be the actual runtime value. In reality the upload size should be the actual value on runtime, because that's the one being used.

If this value was actually useful, we can re-add it.

Actually, the default behavior (with true) worked for me on two hostings (local with Windows and a shared hosting at OVH).

Maybe Directus should provide a way to choose between the value from php.ini and the one from runtime?
It doesn't sound intuitive to me but if both may return wrong values in different cases, maybe both options should be available.

Hey @sebj54, I fixed this by getting configuration values from runtime by default.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benhaynes picture benhaynes  Â·  31Comments

sayore picture sayore  Â·  39Comments

pikzelz picture pikzelz  Â·  32Comments

konradwww picture konradwww  Â·  43Comments

rijkvanzanten picture rijkvanzanten  Â·  25Comments