used better upload_to function, old function sometimes throw UnicodeEncodeError for python 2.6