Skip to content

Commit 1910c08

Browse files
author
Martin Kluska
committed
Updated file receiver to support UploadFile instead of fileIndex #7
Added gitignore
1 parent 7d6578c commit 1910c08

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Created by .ignore support plugin (hsz.mobi)

src/Receiver/FileReceiver.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ class FileReceiver
4545
/**
4646
* The file receiver for the given file index
4747
*
48-
* @param string $fileIndex the desired file index in requests files
49-
* @param Request $request the current request
50-
* @param string $handlerClass the handler class name for detecting the file upload
51-
* @param ChunkStorage|null $chunkStorage the chunk storage, on null will use the instance from app container
52-
* @param AbstractConfig|null $config the config, on null will use the instance from app container
48+
* @param string|UploadedFile $fileIndexOrFile the desired file index to use in request or the final UploadedFile
49+
* @param Request $request the current request
50+
* @param string $handlerClass the handler class name for detecting the file upload
51+
* @param ChunkStorage|null $chunkStorage the chunk storage, on null will use the instance from app container
52+
* @param AbstractConfig|null $config the config, on null will use the instance from app container
5353
*/
54-
public function __construct($fileIndex, Request $request, $handlerClass, $chunkStorage = null, $config = null)
54+
public function __construct($fileIndexOrFile, Request $request, $handlerClass, $chunkStorage = null, $config = null)
5555
{
5656
$this->request = $request;
57-
$this->file = $request->file($fileIndex);
57+
$this->file = is_object($fileIndexOrFile) ? $fileIndexOrFile : $request->file($fileIndexOrFile);
5858
$this->chunkStorage = is_null($chunkStorage) ? ChunkStorage::storage() : $chunkStorage;
5959
$this->config = is_null($config) ? AbstractConfig::config() : $config;
6060

0 commit comments

Comments
 (0)