Hi all,
I have written a small app to connect to a HTTP server and transffer files via HTTP post. It
actually should upload jpeg files to http set-up.
here is the code I have written,
{
http->setHost(url.host(), 80);
int filesize = putFile->size();
header.setValue("enctype","multipart/form-data");
header.setValue("Host", url.host());
header.setValue("Content-type","image/jpeg");
header.setValue("Connection", "keep-alive");
header.
setValue("Size",
QString::number(filesize
));
header.setContentType("image/jpeg");
header.setContentLength(filesize);
http->request(header, putFile);
}
void Sender( QString postfile , QString posturl)
{
QUrl url(posturl);
http->setHost(url.host(), 80);
QFile *putFile = new QFile(postfile);
putFile->open(QIODevice::ReadOnly);
int filesize = putFile->size();
QHttpRequestHeader header("POST", url.path()); /* header */
header.setValue("enctype","multipart/form-data");
header.setValue("Host", url.host());
header.setValue("Content-type","image/jpeg");
header.setValue("Connection", "keep-alive");
header.setValue("Size",QString::number(filesize));
header.setContentType("image/jpeg");
header.setContentLength(filesize);
http->request(header, putFile);
}
To copy to clipboard, switch view to plain text mode
Iam filling in all the data to the request header and sending it to http request. But I am getting error 5: Internal server error. Am I doing some thing wrong here?
Thanks,
Raajesh
Bookmarks