0

I have used barryvdh/laravel-dompdf Laravel package for importing Excel file but I am getting the mentioned error in the attached screenshot.

enter image description here Controller to save an excel file:

    if ($request->hasFile('upload_mcq_file') and in_array($request->upload_mcq_file->extension(), array('xlsx', 'xlt', 'xltx', 'xls', 'xls', 'csv'))) {
        $image = $request->upload_mcq_file;
        $fileName = time() . '.' . $image->getClientOriginalName();
        $image->move('admin/mcqs/', $fileName);
        $path = 'admin/mcqs/' . $fileName;
    }
    $data = Excel::import(new MCQPaperImport, $path);

MCQPaperImport Class below:

class MCQPaperImport implements ToModel
{
    public function model(array $row)
    {
        return new MCQPaper([
            'product_id' => request('product_id'),
            'product_type' => request('product_type'),
            'question' => $row[0],
            'answer' => $row[1],
            'option1' => $row[2],
            'option2' => $row[3],
            'option3' => $row[4],
            'option4' => $row[5],
            'mark' => $row[6],
            'created_at' => Carbon::now('Asia/Kolkata'),
            'updated_at' => Carbon::now('Asia/Kolkata'),
        ]);
    }
}

![Table schema is mentioned in this image][Table schema is mentioned in this image]

ashish patel
  • 169
  • 1
  • 6
  • 1
    what is your Laravel version? and dom-pdf version? – Sapnesh Naik Mar 20 '20 at 06:12
  • Thanks, @SapneshNaik for your reply, please find the detail below: "php": "^7.2", "barryvdh/laravel-dompdf": "^0.8.5", "laravel/framework": "^6.2" – ashish patel Mar 20 '20 at 06:56
  • 1
    _“Table schema is mentioned in this image”_ - uh huh. And what exactly are we supposed to do with that information, considering that the error is a file system access issue? – CBroe Mar 20 '20 at 09:00
  • I supposed to provide all the details regarding this issue. – ashish patel Mar 20 '20 at 12:47

0 Answers0