Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Upload process in pyqt(pyside)
Forum Update on Monday, May 27th 2025

Upload process in pyqt(pyside)

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 880 Views
  • 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 Offline
    M Offline
    Mohammadhzp
    wrote on 14 Jan 2014, 13:07 last edited by
    #1

    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
    0
    • M Offline
      M Offline
      Mohammadhzp
      wrote on 14 Jan 2014, 22:45 last edited by
      #2

      any help ?

      1 Reply Last reply
      0

      2/2

      14 Jan 2014, 22:45

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved