Redirect was inside the for loop in UploadFile, moved it outside for loop. Also closed file after copy in place of defer keyword.