Thank you wysota for your help,
I tried a length of 43 characters (39 characters of header + 4 characters of datas), but It doesn't work better...
QNetworkRequest req;
req.
setUrl(QUrl("https://mywebsite.com/upload.php"));
req.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=-----------------1111553253537452673632"); //39
req.setHeader(QNetworkRequest::ContentLengthHeader, 43);
manager->post(req, "-----------------1111553253537452673632abcd");
QNetworkRequest req;
req.setUrl(QUrl("https://mywebsite.com/upload.php"));
req.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=-----------------1111553253537452673632"); //39
req.setHeader(QNetworkRequest::ContentLengthHeader, 43);
manager->post(req, "-----------------1111553253537452673632abcd");
To copy to clipboard, switch view to plain text mode
He is the remote PHP script:
<?
$fhLog = fopen("log.txt",'a');
foreach ($_FILES as $myfile) {
fwrite($fhLog, $myfile['tmp_name']);
}
fclose($fhLog);
?>
<?
$fhLog = fopen("log.txt",'a');
foreach ($_FILES as $myfile) {
fwrite($fhLog, $myfile['tmp_name']);
}
fclose($fhLog);
?>
To copy to clipboard, switch view to plain text mode
As I said, when using a basic upload form, the PHP script is getting correctly the uploaded file, but with QT, the PHP script is called well, I can send HTTP headers fields but I don't find a way to upload files...
Sending just POST fields with QT to a PHP script also works (I then get the fields in the PHP using $_POST['myField]). The only problem is with uploaded files... Grrrr...
I should do a wireshark capture to see the QT request content but It's not really easy...
There must be some examples on the web, but I can't find anyone...
I hope someone can give me some more help.
Thanks.
Oscar
Bookmarks