I have created an http website using IIS according, It is successfully opening from web browsers from different PCs. Now what I am try to do is writing an normal text file in that server from different PC through below Code.
Now last InternetWriteFile is success, but nothing is written in that file??
Any one have any idea whats happening?
[INFO:wbsite http://10.195.13.128/PostData is opening through a default html site.
That PostData is in local disk D://PostData with Sample.txt file there.(its mapped through IIS)]
Actually may aim is to write a file in http server...(ftp not allowed in my project)
***************************************
BOOL CPostFile::ConnectionEstablishment()
{
BOOL bRet = TRUE;
DWORD err;
INTERNET_BUFFERS BufferIn = {0};
hOpen_ = InternetOpen(L"PosrdataApp", INTERNET_OPEN_TYPE_PRECONFIG,
NULL,
NULL,
0);
if(NULL == hOpen_)
{
err = GetLastError();
return FALSE;
}
hConnect_ = InternetConnect(hOpen_, L"10.195.13.128",
INTERNET_DEFAULT_HTTP_PORT,
NULL, NULL, INTERNET_SERVICE_HTTP,
NULL,
NULL);
if(NULL == hConnect_)
{
err = GetLastError();
return FALSE;
}
const TCHAR* lplpszAcceptTypes[] = {L"text/xml",
L"application/xml",L"application/xhtml+xml",L"text/html;q=0.9",
L"text/plain;q=0.8",L"image/png",L"*/*;q=0.5", NULL};
hRequest_ = HttpOpenRequest(hConnect_, L"POST", L"PostData/Sample.txt",
NULL, NULL, lplpszAcceptTypes, INTERNET_FLAG_KEEP_CONNECTION, 0);
if(NULL == hRequest_)
{
err = GetLastError();
return FALSE;
}
if(!HttpAddRequestHeaders(hRequest_,
L"Content-Type: text/plain",
-1L,
HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD))
{
err = GetLastError();
return FALSE;
}
ZeroMemory(&BufferIn, sizeof(INTERNET_BUFFERS));
BufferIn.dwBufferTotal =8;
BufferIn.dwStructSize = sizeof(INTERNET_BUFFERS);
if(!HttpSendRequestEx(hRequest_, &BufferIn, NULL, HSR_INITIATE, 0))
{
err = GetLastError();
}
InternetWriteFile( hRequest_, "hi sala", 8,&dwBytesWritten);
err = GetLastError();
return bRet;
}
*********************
Can Anyone help?