We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9aa106c commit a528db8Copy full SHA for a528db8
src/Models/S3File.php
@@ -17,7 +17,14 @@ class S3File extends File
17
18
public function calculateFilesize(): int
19
{
20
- return $this->getReadableStream()->getSize();
+ // Use a separate, immediately discarded, stream to get the file size
21
+ // to avoid the main stream from being opened prematurely then timing
22
+ // out before the file contents can be streamed.
23
+ $stream = $this->buildReadableStream();
24
+ $size = $stream->getSize();
25
+ $stream->close();
26
+
27
+ return $size;
28
}
29
30
public function setS3Client(S3Client $client): self
0 commit comments