@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | // Generate a unique file name |
49 | 49 | $originName = $file->getClientOriginalName(); |
50 | - $fileName = pathinfo($originName, PATHINFO_FILENAME) . '_' . time() . '.' . $extension; |
|
50 | + $fileName = pathinfo($originName, PATHINFO_FILENAME).'_'.time().'.'.$extension; |
|
51 | 51 | |
52 | 52 | try { |
53 | 53 | // Ensure the upload directory exists and has correct permissions |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $file->move($uploadDir, $fileName); |
61 | 61 | |
62 | 62 | // Build the URL for the uploaded file |
63 | - $fileUrl = asset('storage/editorimages/' . $fileName); |
|
63 | + $fileUrl = asset('storage/editorimages/'.$fileName); |
|
64 | 64 | |
65 | 65 | // Check if the request contains the CKEditor function number |
66 | 66 | if ($request->has('CKEditorFuncNum')) { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return response()->json(['uploaded' => 1, 'fileName' => $fileName, 'url' => $fileUrl]); |
75 | 75 | |
76 | 76 | } catch (\Exception $e) { |
77 | - return response()->json(['uploaded' => 0, 'error' => ['message' => 'Upload failed: ' . $e->getMessage()]], 500); |
|
77 | + return response()->json(['uploaded' => 0, 'error' => ['message' => 'Upload failed: '.$e->getMessage()]], 500); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |