@@ -41,7 +41,6 @@ class FilexController extends Controller
4141 /**
4242 * Cache size limits (removed unused constant)
4343 */
44-
4544 public function __construct (FilexService $ filexService )
4645 {
4746 $ this ->filexService = $ filexService ;
@@ -167,8 +166,8 @@ protected function handleChunkedUpload(Request $request, $file): JsonResponse
167166 $ originalFileName = $ file ->getClientOriginalName ();
168167
169168 // Create temp directory for chunks with proper permissions
170- $ tempDir = 'temp/chunks/ ' . $ uuid ;
171- $ chunkPath = $ tempDir . '/chunk_ ' . $ chunkIndex ;
169+ $ tempDir = 'temp/chunks/ ' . $ uuid ;
170+ $ chunkPath = $ tempDir. '/chunk_ ' . $ chunkIndex ;
172171 $ tempDisk = $ this ->getTempDisk ();
173172
174173 try {
@@ -256,7 +255,7 @@ public function deleteTempFile(Request $request, string $filename): JsonResponse
256255 {
257256 try {
258257 // Reconstruct the temp path from the filename
259- $ tempPath = 'temp/ ' . $ filename ;
258+ $ tempPath = 'temp/ ' . $ filename ;
260259
261260 // Security check - ensure file is in temp directory and filename is valid
262261 if (
@@ -304,7 +303,7 @@ public function deleteTempFile(Request $request, string $filename): JsonResponse
304303 'timestamp ' => now ()->toISOString (),
305304 ]);
306305 } catch (\Exception $ e ) {
307- Log::error ('Temp file deletion error: ' . $ e ->getMessage (), [
306+ Log::error ('Temp file deletion error: ' . $ e ->getMessage (), [
308307 'temp_path ' => $ request ->input ('tempPath ' ),
309308 'filename ' => $ filename ,
310309 'user_id ' => Auth::check () ? Auth::id () : null ,
@@ -326,7 +325,7 @@ public function deleteTempFile(Request $request, string $filename): JsonResponse
326325 public function getTempFileInfo (Request $ request , string $ filename ): JsonResponse
327326 {
328327 // Reconstruct the temp path from the filename
329- $ tempPath = 'temp/ ' . $ filename ;
328+ $ tempPath = 'temp/ ' . $ filename ;
330329
331330 // Security check - ensure file is in temp directory and filename is valid
332331 if (
@@ -388,7 +387,7 @@ protected function mergeChunksStreaming(string $tempDir, string $finalPath, int
388387
389388 try {
390389 for ($ i = 0 ; $ i < $ totalChunks ; $ i ++) {
391- $ chunkFile = $ tempDir . '/chunk_ ' . $ i ;
390+ $ chunkFile = $ tempDir. '/chunk_ ' . $ i ;
392391
393392 if ($ tempDisk ->exists ($ chunkFile )) {
394393 $ chunkFullPath = $ tempDisk ->path ($ chunkFile );
@@ -467,7 +466,7 @@ public function getUploadConfig(): JsonResponse
467466 'max_execution_time ' => ini_get ('max_execution_time ' ),
468467 ],
469468 'app_settings ' => [
470- 'max_file_size ' => ConfigHelper::getMaxFileSize () / (1024 * 1024 ) . 'MB ' ,
469+ 'max_file_size ' => ConfigHelper::getMaxFileSize () / (1024 * 1024 ). 'MB ' ,
471470 'performance_memory_limit ' => ConfigHelper::get ('performance.memory_limit ' ),
472471 'performance_time_limit ' => ConfigHelper::get ('performance.time_limit ' ),
473472 'temp_disk ' => ConfigHelper::getTempDisk (),
@@ -605,7 +604,7 @@ public function uploadBulk(Request $request): JsonResponse
605604 ]);
606605 }
607606
608- $ successCount = count (array_filter ($ results , fn ($ r ) => $ r ['success ' ]));
607+ $ successCount = count (array_filter ($ results , fn ($ r ) => $ r ['success ' ]));
609608 $ failCount = count ($ results ) - $ successCount ;
610609
611610 PerformanceMonitor::endTimer ('bulk_upload ' , [
@@ -711,7 +710,7 @@ protected function validateBasicUploadFile($file): array
711710 public function deleteTempDirectory (Request $ request , string $ uuid ): JsonResponse
712711 {
713712 try {
714- $ tempDir = 'temp/chunks/ ' . $ uuid ;
713+ $ tempDir = 'temp/chunks/ ' . $ uuid ;
715714
716715 // Security check - ensure directory is valid
717716 if (
@@ -749,7 +748,7 @@ public function deleteTempDirectory(Request $request, string $uuid): JsonRespons
749748 'timestamp ' => now ()->toISOString (),
750749 ]);
751750 } catch (\Exception $ e ) {
752- Log::error ('Temp directory deletion error: ' . $ e ->getMessage (), [
751+ Log::error ('Temp directory deletion error: ' . $ e ->getMessage (), [
753752 'uuid ' => $ uuid ,
754753 'user_id ' => Auth::check () ? Auth::id () : null ,
755754 'exception ' => $ e ->getTraceAsString (),
@@ -941,7 +940,7 @@ protected function errorResponse(string $message, int $code = 500, ?string $erro
941940 */
942941 protected function handleUploadError (\Exception $ e , $ request ): JsonResponse
943942 {
944- Log::error ('File upload error: ' . $ e ->getMessage (), [
943+ Log::error ('File upload error: ' . $ e ->getMessage (), [
945944 'exception ' => $ e ,
946945 'request ' => $ request ->all (),
947946 'user_id ' => Auth::id (),
@@ -1200,7 +1199,7 @@ private function updateUploadProgress(int $bytesWritten, int $totalSize): void
12001199 ];
12011200
12021201 Cache::put (
1203- 'upload_progress_ ' . request ()->input ('dzuuid ' ),
1202+ 'upload_progress_ ' . request ()->input ('dzuuid ' ),
12041203 $ progress ,
12051204 now ()->addMinutes (5 )
12061205 );
@@ -1237,9 +1236,9 @@ private function logUploadMetrics(
12371236 'chunk_index ' => $ chunkIndex + 1 ,
12381237 'total_chunks ' => $ totalChunks ,
12391238 'size ' => ByteHelper::formatBytes ($ size ),
1240- 'duration ' => $ duration . 's ' ,
1239+ 'duration ' => $ duration. 's ' ,
12411240 'memory_used ' => ByteHelper::formatBytes ($ memoryUsed ),
1242- 'throughput ' => ByteHelper::formatBytes ((int ) ($ size / $ duration )) . '/s ' ,
1241+ 'throughput ' => ByteHelper::formatBytes ((int ) ($ size / $ duration )). '/s ' ,
12431242 ]);
12441243 }
12451244
@@ -1249,7 +1248,7 @@ private function logUploadMetrics(
12491248 private function getUploadedChunksCount (string $ tempDir ): int
12501249 {
12511250 return collect ($ this ->getTempDisk ()->files ($ tempDir ))
1252- ->filter (fn ($ file ) => str_contains ($ file , 'chunk_ ' ))
1251+ ->filter (fn ($ file ) => str_contains ($ file , 'chunk_ ' ))
12531252 ->count ();
12541253 }
12551254
@@ -1268,7 +1267,7 @@ private function finalizeChunkedUpload(
12681267
12691268 // Generate final filename
12701269 $ finalFileName = $ this ->filexService ->generateFileName ($ originalFileName );
1271- $ finalPath = 'temp/ ' . $ finalFileName ;
1270+ $ finalPath = 'temp/ ' . $ finalFileName ;
12721271
12731272 // Merge chunks with optimized streaming
12741273 $ this ->mergeChunksStreaming ($ tempDir , $ finalPath , $ totalChunks );
0 commit comments