Adding any php build in function inside the routes is throwing an error

    _$app->post("/jobs",function(Request $request,Response $response,$args){_

_    	$files=$request->getUploadedFiles();_
_    	if(empty($files['bannerimage'])){_
_    		throw new Exception('Expected background image');_
_    	}_
_    	$uploadfile=$files['bannerimage'];_
_    	//lets upload by checking if everything is fine_
_    	//will check file size too later_
_    	if($uploadfile->getError()===UPLOAD_ERR_OK){_
_    		$filename=md5($uploadfile->getClientFilename());_
_    		//$uniquename=$filename.time();_
_    		//move from temporary folder_
_    		$uploadfile->moveTo("uploads/$filename");_
_    	}_
_    	return "file added name is $filename";_
_    });_

The routes works great but whenever I add any build in function like you can see I have used md5 for the file name after upload , which throws an Error 404 error.

Can somebody make me clear on why is it show. Is route not the right place to do that or what might be the real issue.


Have a look at route middleware, see the example here: