def upload(cookie, source_path, path, upload_mode):
ondup = const.UPLOAD_ONDUP[upload_mode]<EOL>dir_name, file_name = os.path.split(path)<EOL>url = '<STR_LIT>'.join([<EOL>const.PCS_URL_C,<EOL>'<STR_LIT>',<EOL>'<STR_LIT>', ondup,<EOL>'<STR_LIT>', encoder.encode_uri_component(dir_name),<EOL>'<STR_LIT>', encoder.encode_uri_component(file_name),<EOL>'<STR_LIT:&>', cookie.sub_output('<STR_LIT>'),<EOL>])<EOL>with open(source_path, '<STR_LIT:rb>') as fh:<EOL><INDENT>data = fh.read()<EOL><DEDENT>fields = []<EOL>files = [('<STR_LIT:file>', file_name, data)]<EOL>headers = {'<STR_LIT>': const.ACCEPT_HTML, '<STR_LIT>': const.PAN_URL}<EOL>req = net.post_multipart(url, headers, fields, files)<EOL>if req:<EOL><INDENT>return json.loads(req.data.decode())<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>
上传一个文件.

    这个是使用的网页中的上传接口.
    upload_mode - const.UploadMode, 如果文件已在服务器上存在:
      * overwrite, 直接将其重写.
      * newcopy, 保留原先的文件, 并在新上传的文件名尾部加上当前时间戳.