PDA

View Full Version : QHttp request problem on MAC Pro



gamitkumar
30th December 2008, 12:26
Hello Every one

i have developed an application for upload file to server on MAC pro.it works fine when i have login in computer in as Admin mode ...but System got crashes (KERNAL PANIC )when i login as parental account .......code is given below


QString fileName = filename;
QFile *userfile = new QFile(fileName);
if ( !userfile->open(QIODevice::ReadOnly) )
{
QMessageBox::information(this, tr("HTTP"),
tr("Unable to open the file %1: %2.")
.arg(userfile->errorString()));
}

QHttpRequestHeader header("POST", "/macUpd.php",1,1);
header.setValue("Host","192.168.100.161");
header.setValue("Content-type", "multipart/form-data, boundary=AaB03x");
header.setValue("Cache-Control", "no-cache");
header.setValue("Accept","*/*");
QByteArray byt(fileName.toUtf8());
QByteArray bytes;
bytes.append("--AaB03x\r\n");
bytes.append("content-disposition: ");
bytes.append("form-data; name=\"uploadfile\"\r\n");
bytes.append("\r\n");
bytes.append("0\r\n");
bytes.append("--AaB03x\r\n");
bytes.append("content-disposition: ");
bytes.append("form-data; name=\"uploadfile\"; filename=\"" + byt+ "\"\r\n");
bytes.append("Content-Transfer-Encoding: binary\r\n");
bytes.append("\r\n");
bytes.append(userfile->readAll());
userfile->close(); // the file is opened earlier in the code
bytes.append("\r\n");
bytes.append("--AaB03x--");
int contentLength = bytes.length();
header.setContentLength(contentLength);
http->request(header, bytes,0);


is there any idea from u gye......why SYSTEM crashes when it run from parental account on MAC pro .

Thanks

wysota
30th December 2008, 12:47
If you experience a system crash then the problems seems to be not in your application. Whatever it does, it can crash itself, but not the system.

In doubt try switching from QHttp to QNetworkAccessManager, it is less error prone but I doubt this will help in any way.