我需要在单击按钮时上传文件,并且文件应自动保存在单独的目录中。
我尝试过的是:
Class Upload():
def setupUi(self):
....
self.upload_btn.clicked.connect(self.fileOpen)
def fileOpen(self):
file=QtWidgets.QFileDialog.getOpenFileName(None,'Open File',"F:\ ")
答案 0 :(得分:0)
使用python requests模块,类似于:
import requests
files = {'upload_file': open('yourfile.name','rb')}
values = {'value_1': 'arg_1'}
r = requests.post(url, files=files, data=values)