Sending Excel file via post script.
-
Hi,
I want to send a excel file via post:QNetworkRequest request( QUrl( "my url") ); request.setHeader( QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded" ); QUrlQuery params; params.addQueryItem( "username", accountName ); params.addQueryItem( "file", reportFile->readAll() ); QNetworkAccessManager manager; QNetworkReply *reply = manager.post( request, params.query().toUtf8() );
But I get the upload error .
The post script is tested and works fine.
Can anybody check if I do something wrong there?
Any hints would be priceless.Best regards,
Tomek -
Hi,
I want to send a excel file via post:QNetworkRequest request( QUrl( "my url") ); request.setHeader( QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded" ); QUrlQuery params; params.addQueryItem( "username", accountName ); params.addQueryItem( "file", reportFile->readAll() ); QNetworkAccessManager manager; QNetworkReply *reply = manager.post( request, params.query().toUtf8() );
But I get the upload error .
The post script is tested and works fine.
Can anybody check if I do something wrong there?
Any hints would be priceless.Best regards,
Tomek -
Hi,
I want to send a excel file via post:QNetworkRequest request( QUrl( "my url") ); request.setHeader( QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded" ); QUrlQuery params; params.addQueryItem( "username", accountName ); params.addQueryItem( "file", reportFile->readAll() ); QNetworkAccessManager manager; QNetworkReply *reply = manager.post( request, params.query().toUtf8() );
But I get the upload error .
The post script is tested and works fine.
Can anybody check if I do something wrong there?
Any hints would be priceless.Best regards,
Tomek -
Hi,
I want to send a excel file via post:QNetworkRequest request( QUrl( "my url") ); request.setHeader( QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded" ); QUrlQuery params; params.addQueryItem( "username", accountName ); params.addQueryItem( "file", reportFile->readAll() ); QNetworkAccessManager manager; QNetworkReply *reply = manager.post( request, params.query().toUtf8() );
But I get the upload error .
The post script is tested and works fine.
Can anybody check if I do something wrong there?
Any hints would be priceless.Best regards,
Tomek -
You are right, but I don't have any experience with multipart sending.
Could anybody give ma a hint how to prepare that?I have to send to parameters:
1)Username as a string
2)File as a binary dataHow to prepare particular parts?
BR/T