From dedf1981cf40e07eb7e7bc7809ff8886418f2e0e Mon Sep 17 00:00:00 2001 From: isaacdew2 <43962295+isaacdew2@users.noreply.github.com> Date: Mon, 3 Jun 2024 03:12:29 -0600 Subject: [PATCH] Change filePath to real path if it's an upload (#4132) --- src/Files/TemporaryFile.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Files/TemporaryFile.php b/src/Files/TemporaryFile.php index 5827b99c..fbd7ebd9 100644 --- a/src/Files/TemporaryFile.php +++ b/src/Files/TemporaryFile.php @@ -53,8 +53,10 @@ public function sync(): TemporaryFile public function copyFrom($filePath, string $disk = null): TemporaryFile { if ($filePath instanceof UploadedFile) { - $readStream = fopen($filePath->getRealPath(), 'rb'); - } elseif ($disk === null && realpath($filePath) !== false) { + $filePath = $filePath->getRealPath(); + } + + if ($disk === null && realpath($filePath) !== false) { $readStream = fopen($filePath, 'rb'); } else { $diskInstance = app('filesystem')->disk($disk);