I have tried the following code but getting some errors. Here I can read the input file but I am getting the following error:Deprecated: Function split() is deprecated in C:
I think you need to convert CSV file in collection first. After that you can add loop and call insert queries to insert data.
Here you will get code to convert CSV file into collection array. best-way-to-upload-and-read-csv-file-in-php