I want to upload a txt file that is already delimited by commas and, when I do the local tests with the following code, it works for me as I expected
$databasetable = temp;
$fieldseparator = ",";
$lineseparator = "\n";
$csvfile='c:/archivos/factura.txt';
$pdo = new PDO('mysql:host=localhost;dbname=agesacr_contabilidad;charset=UTF8',$usuario,$pass,array(PDO::MYSQL_ATTR_LOCAL_INFILE => true,PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$affectedRows = $pdo->exec("LOAD DATA LOCAL INFILE ".$pdo->quote($csvfile)." INTO TABLE '$databasetable'");
The code, in local tests under Windows, works very well. But when I place it on the web server it does not work.
To make it work, I have to indicate the host as the server.
I would like to know how to make this code work locally and on the server. Or to be able to upload the file to the server (without botton type file) and then do the load data.