I'm importing .CSV files into mySQL using LOAD DATA LOCAL INFILE, and it's working for all my test files (which are relativity small).
The problem occurs when I try using the real file I want to work with, which is 97MB in size. Is there a limit to the file size I can upload? If there is, how can I overcome it? My code for the query is below:
// Import csv data in table in respective rows.
$sql = "LOAD DATA LOCAL INFILE '$csvFileForLoad' INTO TABLE $tableName
FIELDS TERMINATED BY '~'
LINES TERMINATED BY '\\r\\n'
IGNORE 1 LINES
(@ignore, name, age, gender)";
// Execute query
if (mysqli_query($con,$sql)) {
echo "Table populated successfully.\n";
} else {
echo "Error populating table: " . mysqli_error($con) . ".\n";
}
Thanks!
Have a look inside your php.ini - There should be a setting to tweak in there
upload_max_filesize = 10M
post_max_size = 10M
Also check your vhosts and htaccess files as they may have something like
php_value upload_max_filesize 10M
php_value post_max_size 10M
Don't forget to restart your webserver ;-)
HTHs! Thanks, //P