1

While uploading CSV file in laravel, am getting the error saying

"Symfony \ Component \ HttpFoundation \ File \ Exception \ FileException The file "DealProducts.csv" was not uploaded due to an unknown error".

 $folder = 'owner';
 $path1 = base_path('resources/importedfiles/' . $folder . '/');
 File::makeDirectory($path1, 0777, true, true);
 $file = request()->file('file_name');
 $fileName = md5($file->getClientOriginalName()) . '_' . date('Y-m-d H:i:s') . '.csv';
 $uploadingPath = asset('resources/importedfiles/' . $folder . '/');
     if ($file->move($path1, $fileName)) {
        $offers = $request->get('offers');
        ImportFile::create([
          'file_name' => $fileName,
             'file_size' => round($file->getClientSize() / (1024 * 1024), 2),
             'offer_id'  => $offers,
           ]);

     }
 return redirect('/admin/importfiles');
2
  • You're creating an $uploadingPath, but you're not using it. Why? Commented Apr 9, 2019 at 7:23
  • possible duplicate of stackoverflow.com/questions/44964907/… Commented Apr 9, 2019 at 7:25

1 Answer 1

3

In the php.ini file, change the following

upload_max_filesize = 20M
post_max_size = 20M

This may help.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.