moved duplicated file upload error code logic into base controller