[PyQt] How to add ftp put function in PyQT network ftp demo

不坏阿峰 onlydebian at gmail.com
Tue Jul 1 03:30:49 BST 2014


I want to modify the pyqt network ftp demo to include an upload function,
but I am failing. Could someone can show me how to do this? I have tried to
add this code, but it does not work. [Orignal Demo]
https://github.com/Werkov/PyQt4/blob/master/examples/network/ftp/ftp.py

buttonBox.addButton(self.uploadButton,
            QtGui.QDialogButtonBox.ActionRole)
self.uploadButton = QtGui.QPushButton("upload")
self.uploadButton.clicked.connect(self.selectFile)
def selectFile(self):
    self.filename =QtGui.QFileDialog.getOpenFileName()
    up_fname = re.sub(r".*/","",self.filename)
    upload_file = QtCore.QFile(self.filename)
    self.ftp.put(upload_file, up_fname)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140701/c0e8b163/attachment-0001.html>


More information about the PyQt mailing list