@@ -54,15 +54,15 @@ public function __construct(UploadedFile $file, AbstractHandler $handler, $chunk
54
54
$ this ->chunkFileName = $ handler ->getChunkFileName ();
55
55
56
56
// buid the full disk path
57
- $ this ->chunkFullFilePath = $ this ->chunkStorage ()-> getDiskPathPrefix (). $ this -> getChunkFilePath ();
57
+ $ this ->chunkFullFilePath = $ this ->getChunkFilePath (true );
58
58
59
59
$ this ->handleChunkMerge ();
60
60
}
61
61
62
62
63
63
/**
64
64
* Checks if the file upload is finished (last chunk)
65
- *
65
+ *
66
66
* @return bool
67
67
*/
68
68
public function isFinished ()
@@ -73,11 +73,13 @@ public function isFinished()
73
73
/**
74
74
* Returns the chunk file path in the current disk instance
75
75
*
76
+ * @param bool $absolutePath
77
+ *
76
78
* @return string
77
79
*/
78
- public function getChunkFilePath ()
80
+ public function getChunkFilePath ($ absolutePath = false )
79
81
{
80
- return $ this ->getChunkDirectory ().$ this ->chunkFileName ;
82
+ return $ this ->getChunkDirectory ($ absolutePath ).$ this ->chunkFileName ;
81
83
}
82
84
83
85
/**
@@ -92,11 +94,21 @@ public function getChunkFullFilePath()
92
94
/**
93
95
* Returns the folder for the cunks in the storage path on current disk instance
94
96
*
97
+ * @param boolean $absolutePath
98
+ *
95
99
* @return string
96
100
*/
97
- public function getChunkDirectory ()
101
+ public function getChunkDirectory ($ absolutePath = false )
98
102
{
99
- return $ this ->chunkStorage ()->directory ();
103
+ $ paths = [];
104
+
105
+ if ($ absolutePath ) {
106
+ $ paths [] = $ this ->chunkStorage ()->getDiskPathPrefix ();
107
+ }
108
+
109
+ $ paths [] = $ this ->chunkStorage ()->directory ();
110
+
111
+ return implode ("" , $ paths );
100
112
}
101
113
102
114
/**
@@ -155,7 +167,7 @@ protected function buildFullFileFromChunks()
155
167
$ this ->file ->getClientMimeType (),
156
168
filesize ($ finalPath ), $ this ->file ->getError (),
157
169
true // we must pass the true as test to force the upload file
158
- // to use a standart copy method, not move uploaded file
170
+ // to use a standart copy method, not move uploaded file
159
171
);
160
172
}
161
173
@@ -215,11 +227,11 @@ public function chunkDisk()
215
227
*/
216
228
protected function createChunksFolderIfNeeded ()
217
229
{
218
- $ path = $ this ->getChunkDirectory ();
230
+ $ path = $ this ->getChunkDirectory (true );
219
231
220
232
// creates the chunks dir
221
233
if (!file_exists ($ path )) {
222
234
mkdir ($ path , 0777 , true );
223
235
}
224
236
}
225
- }
237
+ }
0 commit comments