<?php
define("cServidor", "127.0.0.1");
define("cUsuario", "juanquimon");
define("cPass", "123456");
define("cBd", "bd_people");

$conexion = mysqli_connect(cServidor, cUsuario, cPass, cBd);

if ($_FILES['csv']['size'] > 0) {

	$csv = $_FILES['csv']['tmp_name'];

	$handle = fopen($csv,'r');

	while ($data = fgetcsv($handle,1000,",","'")){

		if ($data[0]) {

			mysqli_query($conexion,"INSERT INTO tsaldo (idsaldo, uslegajo, slmes, slanio, slmonto, slfecha) VALUES('".$data[0]."','".$data[1]."','".$data[2]."','".$data[3]."','".$data[4]."','".$data[5]."') ");

		}

	}

	echo 'OK';

}
?>