Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
InvalidArgument: POST requires exacty one file upload per request
mucai last edited by
I try to use QHttpMultiPart to post a file but there is a following errr:
<Message>POST requires exactly one file upload per request.</Message>
The following are my codes:
QFile *file = new QFile(filePath);
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
Do you have any advice?
Code_ReaQtor last edited by
QHttpMultipart is very buggy and I think it uses a very different specification so it always fail.
I have a note in "QNetworkAccessManager":http://qt-project.org/doc/qt-4.8/qnetworkaccessmanager.html entitled "POST with QIODevice" , you might find it useful.
If you are trying to "upload" using a Form, use "FormPost":http://www.tuckdesign.com/sources/Qt , it saved me a lot of time when I was coding for "libqsendspace":https://github.com/Code-ReaQtor/libqsendspace . You just need to modify their source code or you may use the code from my github site ("qsendspace" folder).