W3Developers
6 months ago
608
4
Laravel

404 on uploading more than 10mb file via API

Posted 6 months ago by W3Developers

Hi, i am trying to upload multiple files through API, everything works fine when i upload files below 10mb API returns 404 when upload files larger than 10mb. i have updated upload_max_filesize, max_execution_time, post_max_size and still same response received.

public function image_upload(Request $request){

    $files = $request->file('img');
    $i=0;
    if($files){
        foreach($files as $file){
            $i++;                
             $path = $file->storeAs('images', $i.".".$file->extension()); 
          
        }
        if($path){
            return response()->json(['status' => 0, 'response' => 'file added..']);
        }else{
            return response()->json(['status' => 1, 'response' => 'failed to upload..']);
        }
    }else{
        return response()->json(['status' => 1, 'response' => 'no file received..']);
    }
            
}

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