updated logic in uploadcontroller