Refactor uploadFile, so it uses uploadImage or uploadVideo depending on file type