|
Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_InetHttpSendData
#include "ltweb.h"
L_LTWEB_API L_INT L_InetHttpSendData(hHttp, pData, uSize, pszContentType, pNameValue)
|
HINET hHttp; |
/* handle to an HTTP connection*/ |
|
L_CHAR *pData; |
/* pointer to the data to send*/ |
|
L_UINT32 uSize; |
/* size of pData*/ |
|
L_TCHAR *pszContentType; |
/* HTTP content type*/ |
|
pNAMEVALUE pNameValue; |
/* pointer to a structure */ |
Sends raw data to an HTTP server.
|
Parameter |
Description |
|
hHttp |
Handle to the HTTP connection. It is the same handle obtained using the L_InetHttpConnect function. |
|
pData |
Pointer to data to send in the HTTP request. |
|
uSize |
Size of pData. |
|
pszContentType |
A string describing the content type. This string is usually formatted type/subtype where type is the general content category and subtype is the specific content type. For a full list of supported content types, see your Internet browser documentation or the current HTTP specification. |
|
pNameValue |
A pointer to the structure that contains the name/value pair for this image. This information is used to get the information from a script on the server machine. This name is usually some user-defined name and the value is the filename of the data. |
Returns
|
SUCCESS |
The function was successful. |
|
< 1 |
An error occurred. Refer to Return Codes. |
Comments
It is up to a script on the server side to process the data when it is received. This script is specified in the L_InetHttpOpenRequest function. The script can be any type of file that is recognized by the HTTP Server.
Note: The LEADTOOLS Uploading component can be used in an ASP page to extract the uploaded data.
Required DLLs and Libraries
|
LTWEB For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application |
See Also
|
Functions: |
L_InetHttpSendBitmap, L_InetHttpSendForm, L_InetHttpSendRequest |
|
Topics: |
|
|
|
Example
L_INT InetHttpSendDataExample(L_CHAR * pData,L_UINT32 uSize)
{
HINET hInet;
L_INT nRet;
DWORD dwSizeWrite;
nRet = L_InetHttpConnect(TEXT("www.leadtools.com"),80, TEXT(""),TEXT(""),&hInet);
if(nRet==SUCCESS)
{
nRet = L_InetHttpOpenRequest(hInet,HTTP_GET, TEXT("/upload.asp"), TEXT(""),TEXT("HTTP/1.0"),0);
if(nRet==SUCCESS)
{
L_TCHAR szResponse[2048];
L_UINT32 lsize;
L_UINT uStatus;
L_HANDLE fp;
NAMEVALUE nv;
nv.pszName = TEXT("Data");
nv.pszValue = TEXT("data1.raw");
nRet=L_InetHttpSendData(hInet,pData,uSize, TEXT("image/jpg"),&nv);
if(nRet!=SUCCESS)
{
MessageBox(NULL,TEXT("Error Sending Form"),TEXT("Error"),MB_ICONEXCLAMATION);
nRet = L_InetHttpCloseRequest(hInet);
if(nRet != SUCCESS)
return nRet;
nRet = L_InetHttpDisconnect(hInet);
if(nRet != SUCCESS)
return nRet;
return nRet;
}
nRet = L_InetHttpGetServerStatus(hInet,&uStatus);
if(nRet != SUCCESS)
return nRet;
if(uStatus==L_HTTP_STATUS_OK)
{
lsize = 2048;
nRet = L_InetHttpGetResponse(hInet,(L_CHAR *) szResponse,&lsize);
if(nRet != SUCCESS)
return nRet;
fp =CreateFile(TEXT("output.htm"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
while(lsize!=0)
{
WriteFile(fp,szResponse, lsize, &dwSizeWrite, NULL);
lsize = 1048;
nRet = L_InetHttpGetResponse (hInet,(L_CHAR *)szResponse,&lsize);
if(nRet != SUCCESS)
return nRet;
}
CloseHandle(fp);
}
else
{
MessageBox(NULL,TEXT("Problem With Server"),TEXT("Error"),MB_ICONEXCLAMATION);
lsize = 2048;
nRet = L_InetHttpGetResponse (hInet,(L_CHAR *)szResponse,&lsize);
if(nRet != SUCCESS)
return nRet;
fp =CreateFile(TEXT("error.htm"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
while(lsize!=0)
{
WriteFile(fp,szResponse, lsize, &dwSizeWrite, NULL);
lsize = 1048;
nRet = L_InetHttpGetResponse(hInet,(L_CHAR *)szResponse,&lsize);
if(nRet != SUCCESS)
return nRet;
}
CloseHandle(fp);
}
nRet = L_InetHttpCloseRequest(hInet);
if(nRet != SUCCESS)
return nRet;
}
else
return nRet;
nRet = L_InetHttpDisconnect(hInet);
if(nRet != SUCCESS)
return nRet;
}
else
return nRet;
return SUCCESS;
}