complete upload functionality