Access uploaded file, from a multipart/form-data, without providing a name to the property of the form

If you can’t change that horrible client code I would just modify the parameters on the recieving end so that you get a fixed key that you can permit and work with:

params.merge(
  files: params.values.select { |v| v.is_a?(ActionDispatch::Http::UploadedFile) }
).permit(:foo, :bar, files: [])

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top