Assistance Needed with Fatal Error in File Upload Script mysql_escape_string()

An issue encountered while using the Scriptcase framework. I have encountered a fatal error during the execution of a script that handles file uploads. The error message is as follows:

Fatal error: Uncaught Error: Call to undefined function mysql_escape_string() in C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\app\VERS\api_booking_upload\index.php:2147
Stack trace:

The error seems to be related to the mysql_escape_string function, which I understand is deprecated and removed in recent PHP versions. Below is the relevant code snippet causing the issue:

I believe the issue is caused by the use of mysql_escape_string for escaping the file content, which is not supported in the current PHP version.

Could you please provide guidance on how to modify the code to work correctly with the current version of PHP? Specifically, I would appreciate advice on a suitable replacement for mysql_escape_string that is compatible with the Scriptcase framework.

Thank you for your assistance.

Did you try using PHP: mysqli::real_escape_string - Manual ?