this route receives requests from multiple forms. some send "attachment" some send "upload" some send them both some send more than these two. I want the uploading to be dynamic.
@uniqueginun First of all, if your current code works fine, I would say just follow the simple step, that currently has.
Secondly, if you submit multiple form on same action and not sure whether in future it will submit more form or not, on that situation, you can follow a separate class for each form submittion based on a contract (Interface), that will be following Open Closed Principle (Some may be refer it over engineering of it here).
@uniqueginun The approach suggested by @tray2 looks clean enough already.
Why not you just create separate methods and handle all the logic insider them.
BTW, you can use a loop if you want, but since you can solve any issue without the loop, then what is the purpose of using it? Looping will make iteration, which may affect your performance (depends on how many times it iterate). Therefore I believe looping is unnecessary use here.