Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Upload process in pyqt(pyside)

    General and Desktop
    1
    2
    689
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mohammadhzp last edited by

      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

      1 Reply Last reply Reply Quote 0
      • M
        Mohammadhzp last edited by

        any help ?

        1 Reply Last reply Reply Quote 0
        • First post
          Last post