From 834626ad8e59541e03f4ec18c0d527a13549c615 Mon Sep 17 00:00:00 2001 From: Lynh Date: Mon, 5 Aug 2019 15:02:09 +0700 Subject: [PATCH] Maintain UploadedFile backward compatibility Fix #20 --- src/File.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/File.php b/src/File.php index a24c6b0..fba4a7b 100644 --- a/src/File.php +++ b/src/File.php @@ -114,7 +114,15 @@ public function chunks($name, Closure $closure) $this->appendData($filePath, $file); if ($chunk == $chunks - 1) { - $file = new UploadedFile($filePath, $originalName, 'blob', UPLOAD_ERR_OK, true); + // $file = new UploadedFile($filePath, $originalName, 'blob', UPLOAD_ERR_OK, true); + $file = app()->make(UploadedFile::class, [ + 'filePath' => $filePath, + 'originalName' => $originalName, + 'mimeType' => 'blob', + 'size' => filesize($filePath), + 'error' => UPLOAD_ERR_OK, + 'test' => true, + ]); @unlink($filePath); return $closure($file);