akshay khale akshay khale - 2 months ago 6
PHP Question

Selecting only Non-file Parameters from Laravel Request

For one of my Laravel Web app I want to log all the Request Parameters(Post as well as Get) in database in Json Format for that I am using

$request->all()
Method, which results in an exception when user tries to upload any file.

that's why I want a way to select only Serializable Parameters from the request.(for get as well as for post Requests) or a way to select all the request parameters except files.

Request::except([])
will not work for me since in Except method we will have to provide the file parameter names.

Answer

Since any of the answer didn't work for me I did lots of reading and some digging about laravel but still I could not find the specific solutions I was looking for, so I did a small hack, instead of using Laravel's Request Object and pulling parameters from there I simply used PHP's built in $_REQUEST parameter.

Eg.

$non_file_parameters = $_REQUEST;

$_REQUEST will have both Get as well as Post Parameters except file Parameters coz in Core PHP for files we have $_FILES super global variable.

Thanks guys for your efforts...