Use switch instead of if/elseif
Reduce complexity of prepareFileParam()