@@ -70,7 +70,7 @@ public function setResumableOption(array $resumableOption)
7070 $ this ->resumableOption = array_merge ($ this ->resumableOption , $ resumableOption );
7171 }
7272
73- // sets original filename and extenstion , blah blah
73+ // sets original filename and extension , blah blah
7474 public function preProcess ()
7575 {
7676 if (!empty ($ this ->resumableParams ())) {
@@ -177,9 +177,9 @@ public function handleTestChunk()
177177 {
178178 $ identifier = $ this ->resumableParam ($ this ->resumableOption ['identifier ' ]);
179179 $ filename = $ this ->resumableParam ($ this ->resumableOption ['filename ' ]);
180- $ chunkNumber = $ this ->resumableParam ($ this ->resumableOption ['chunkNumber ' ]);
181- $ chunkSize = $ this ->resumableParam ($ this ->resumableOption ['chunkSize ' ]);
182- $ totalChunks = $ this ->resumableParam ($ this ->resumableOption ['totalChunks ' ]);
180+ $ chunkNumber = ( int ) $ this ->resumableParam ($ this ->resumableOption ['chunkNumber ' ]);
181+ $ chunkSize = ( int ) $ this ->resumableParam ($ this ->resumableOption ['chunkSize ' ]);
182+ $ totalChunks = ( int ) $ this ->resumableParam ($ this ->resumableOption ['totalChunks ' ]);
183183
184184 if (!$ this ->isChunkUploaded ($ identifier , $ filename , $ chunkNumber )) {
185185 return $ this ->response ->header (204 );
@@ -199,9 +199,9 @@ public function handleChunk()
199199 $ file = $ this ->request ->file ();
200200 $ identifier = $ this ->resumableParam ($ this ->resumableOption ['identifier ' ]);
201201 $ filename = $ this ->resumableParam ($ this ->resumableOption ['filename ' ]);
202- $ chunkNumber = $ this ->resumableParam ($ this ->resumableOption ['chunkNumber ' ]);
203- $ chunkSize = $ this ->resumableParam ($ this ->resumableOption ['chunkSize ' ]);
204- $ totalChunks = $ this ->resumableParam ($ this ->resumableOption ['totalChunks ' ]);
202+ $ chunkNumber = ( int ) $ this ->resumableParam ($ this ->resumableOption ['chunkNumber ' ]);
203+ $ chunkSize = ( int ) $ this ->resumableParam ($ this ->resumableOption ['chunkSize ' ]);
204+ $ totalChunks = ( int ) $ this ->resumableParam ($ this ->resumableOption ['totalChunks ' ]);
205205
206206 if (!$ this ->isChunkUploaded ($ identifier , $ filename , $ chunkNumber )) {
207207 $ chunkFile = $ this ->tmpChunkDir ($ identifier ) . DIRECTORY_SEPARATOR . $ this ->tmpChunkFilename ($ filename , $ chunkNumber );
@@ -243,7 +243,7 @@ private function createFileAndDeleteTmp($identifier, $filename)
243243
244244 if ($ this ->createFileFromChunks ($ chunkFiles , $ this ->filepath ) && $ this ->deleteTmpFolder ) {
245245 $ tmpFolder ->delete ();
246- $ this ->uploadComplete = true ;
246+ $ this ->isUploadComplete = true ;
247247 }
248248 }
249249
@@ -295,14 +295,14 @@ public function tmpChunkDir($identifier)
295295
296296 /**
297297 * make directory if it doesn't exists (Immune against the race condition)
298- *
299- *
300- * since the resuamble is usually used with simultaneously uploads,
301- * this sometimes resulted in directory creation btween the *is_dir* check
298+ *
299+ *
300+ * since the resumable is usually used with simultaneously uploads,
301+ * this sometimes resulted in directory creation between the *is_dir* check
302302 * and *mkdir* then following race condition.
303303 * in this setup it will shut down the mkdir error
304304 * then try to check if directory is created after that
305- *
305+ *
306306 * @param string $path the directoryPath to ensure
307307 * @return void
308308 * @throws \Exception
@@ -361,7 +361,7 @@ public function createFileFromChunks($chunkFiles, $destFile)
361361
362362 public function moveUploadedFile ($ file , $ destFile )
363363 {
364- //workaround cakephp error regarding: TMP not defined
364+ //workaround cakephp error regarding: TMP not defined
365365 define ("TMP " ,sys_get_temp_dir ());
366366
367367 $ file = new File ($ file );
0 commit comments