finish upload code and save to mysql