@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function upload(Request $request) |
| 33 | 33 | { |
| 34 | 34 | // Ensure a file was uploaded |
| 35 | - if (! $request->hasFile('upload')) { |
|
| 35 | + if (!$request->hasFile('upload')) { |
|
| 36 | 36 | return response()->json(['uploaded' => 0, 'error' => ['message' => 'No file was uploaded.']], 400); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | // Validate file type to ensure it's an image |
| 42 | 42 | $allowedExtensions = ['jpg', 'jpeg', 'png', 'gif']; |
| 43 | 43 | $extension = $file->getClientOriginalExtension(); |
| 44 | - if (! in_array(strtolower($extension), $allowedExtensions)) { |
|
| 44 | + if (!in_array(strtolower($extension), $allowedExtensions)) { |
|
| 45 | 45 | return response()->json(['uploaded' => 0, 'error' => ['message' => 'Invalid file type.']], 400); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | try { |
| 53 | 53 | // Ensure the upload directory exists and has correct permissions |
| 54 | 54 | $uploadDir = public_path('storage/editorimages'); |
| 55 | - if (! is_dir($uploadDir)) { |
|
| 55 | + if (!is_dir($uploadDir)) { |
|
| 56 | 56 | mkdir($uploadDir, 0775, true); // Create directory if it doesn't exist |
| 57 | 57 | } |
| 58 | 58 | |