file('file'); // Generate a unique file name $file_name = date('YmdHis') . '.' . $file->getClientOriginalExtension(); // Save the file to the public/uploads directory $path = $file->storeAs('uploads', $file_name, 'public'); // Return a JSON response with the file name and upload status return response()->json([ 'filename' => $file_name, 'status' => 'success' ]); } }