Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel Read CSV File

 if (!empty($request->files) && $request->hasFile('csv_file')) {
                $file = $request->file('csv_file');
                $type = $file->getClientOriginalExtension();
                $real_path = $file->getRealPath();
                if ($type <> 'csv') {
                    Alert::error('Wrong file extension', 'Only CSV is allowed')->persistent('close');
                    return redirect()->back();
                }
                $data = $this->readCSV($real_path, array('delimiter' => ','));
            }
 
PREVIOUS NEXT
Tagged: #Laravel #Read #CSV #File
ADD COMMENT
Topic
Name
6+2 =