Upload process in pyqt(pyside)
-
Hello
I'm pretty new to Pyside(python)
I need to upload files to xfilesharing in my program
but I can't find out how to send header or how to open a html file and etc(I have no idea how it works actually)
I think someone "here":http://qt-project.org/forums/viewthread/11361 already answer what I'm looking for but I couldn't understand the code since I don't know c or c++
I was hoping you guys coud give me a hint
here is my upload mehod :
@Temp = QtCore.QByteArray(data)
if self._reply is None:
request = QtNetwork.QNetworkRequest(QtCore.QUrl(url))
request.setHeader(
QtNetwork.QNetworkRequest.ContentTypeHeader,
'multipart/form-data; boundary=---------------------------6550436631168000750764841')
request.setRawHeader(
QtNetwork.QNetworkRequest.ContentTypeHeader,
'image/png')
request.setHeader(
QtNetwork.QNetworkRequest.ContentDispositionHeader,
'form-data; name="image_field"; filename="icon.png"')
request.setHeader(
QtNetwork.QNetworkRequest.ContentLengthHeader,
len(Temp))self._reply = self.parent().post(request, Temp) self._reply.uploadProgress.connect(self.handleUploadProgress) self._reply.finished.connect(self.handleFinished)@
and here is my html form@
<form enctype="multipart/form-data" method="post" action="123.php">
<input type="file" size="32" name="image_field" value="">
<input type="submit" name="Submit" value="upload">
</form>@
I used tamper(addon for firefox) to get this headers,but still no luck
where I'm doing wrong ?
thanks -
any help ?