Skip to content

Commit

Permalink
Slightly increase chunk size
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed May 1, 2024
1 parent a216174 commit f311c15
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Api/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public static function chunk(
string $source,
string $filename
): string|null {
;
// if the file is uploaded in chunks
if ($isChunk = $api->requestHeaders('X-Upload-Chunk')) {
// ensure the directory exists
Expand Down Expand Up @@ -84,13 +83,13 @@ public static function chunkSize(): int
Str::toBytes(ini_get('post_max_size'))
];

//if server is behind a cloudflare proxy
// if server is behind a cloudflare proxy
if (isset($_SERVER['HTTP_CF_CONNECTING_IP']) === true) {
$max[] = Str::toBytes('100M');
}

// to be sure, only use 90% of the max possible upload size
return (int)floor(min($max) * 0.9);
// to be sure, only use 95% of the max possible upload size
return (int)floor(min($max) * 0.95);
}

/**
Expand Down

0 comments on commit f311c15

Please sign in to comment.