I am trying to upload csv file so that I can upload those data into the database. The code for the same is as bellow
public function upload(Request $request){
set_time_limit(0);
ini_set('MAX_EXECUTION_TIME', 36000);
$file = Input::file('file');
$filePath = $file->getRealPath();
$handle = fopen($filePath, "r");
while(!feof($handle))
{
<< DO THE DATABASE OPERATION >>
}
fclose($handle);
return redirect()->back()->with('success', 'File uploaded successfully');
}
This works fine if the file size is less lets say about 100 or 200mb. But when the file size is big like 2GB. It closes the local server. In the console, it says out of memory
My php.ini settings are :
post_max_size=10000M
upload_max_filesize=10000M
Can anyone please tell me why this is happening and how can i fix it. I did follow a couple of threads on StackOverflow like this
phpMyAdmin: Can't import huge database file, any suggestions?
Large file uploads failing php
But unfortunately, these solutions did not help.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire