Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_network_access_qhttpmultipart.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
6
9textPart.setBody("my text");
10
14QFile *file = new QFile("image.jpg");
17file->setParent(multiPart); // we cannot delete the file now, so delete it with the multiPart
18
21
22QUrl url("http://my.server.tld");
24
27multiPart->setParent(reply); // delete the multiPart with the reply
28// here connect signals etc.
\inmodule QtCore
Definition qfile.h:93
QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition qfile.cpp:904
The QHttpMultiPart class resembles a MIME multipart message to be sent over HTTP.
void append(const QHttpPart &httpPart)
Appends httpPart to this multipart.
The QHttpPart class holds a body part to be used inside a HTTP multipart MIME message.
void setBodyDevice(QIODevice *device)
Sets the device to read the content from to device.
void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)
Sets the value of the known header header to be value, overriding any previously set headers.
void setBody(const QByteArray &body)
Sets the body of this MIME part to body.
The QNetworkAccessManager class allows the application to send network requests and receive replies.
QNetworkReply * post(const QNetworkRequest &request, QIODevice *data)
Sends an HTTP POST request to the destination specified by request and returns a new QNetworkReply ob...
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
void setParent(QObject *parent)
Makes the object a child of parent.
Definition qobject.cpp:2195
\inmodule QtCore
Definition qurl.h:94
\inmodule QtCore
Definition qvariant.h:65
QNetworkAccessManager manager
QHttpMultiPart * multiPart
[0]
QNetworkRequest request(url)
QUrl url("http://my.server.tld")
QNetworkReply * reply