I am making a logging system which keeps track of all the request the web server is getting. How do I check if any of the requests contain any file i.e. any file upload action?
Asked
Active
Viewed 1,396 times
1 Answers
4
Maybe check what is your request mime type.
request.content_mime_type.symbol
=> :multipart_form
If that returns :multipart_form
you can go through the params
values and search for kind of ActionDispatch::Http::UploadedFile
.
-
Your way solves the purpose, but going through each params i.e. nested params too, will be so much of an overhead and not feasible in case of high level of nesting in the params. – Rajesh Paul Aug 06 '16 at 06:39