nafeeur10
1 month ago
564
1
Laravel

How to upload json file and Extract in Laravel 7

Posted 1 month ago by nafeeur10

Hello,

I want to upload a json file and Extract it in Controller and keep the data in Database. What will be the approach?

File Upload Controller:

public function fileUploadPost(Request $request)
    {
 
        dd($request);

        $request->validate([
            'file' => 'required|mimes:pdf,xlx,csv,json|max:2048',
        ]);
  
        $fileName = time().'.'.$request->file->extension();  
   
        $request->file->move(public_path('uploads'), $fileName);
   
        return back()
            ->with('success','You have successfully upload file.')
            ->with('file',$fileName);
   
    }

File is not uploading!!!

dd() is giving me this output:

https://ibb.co/55cd2Xb

Please sign in or create an account to participate in this conversation.