Can anyone plz tell me,how to accept request on server side,coming from HttpSendRequest () API(For Http Upload Control in VB).I am posting my code:
I think I need Server side component(may be in ASP),but how to implement it?
Public Function UploadFileHTTP( ByVal localFileName As String, ByVal remoteFileName As String) As Integer
Dim nRet As Integer
Dim bRet, bQueryInfo As Boolean
Dim iRet As Integer
Dim nFileHandle, i As Integer
Dim bData(BUFFER_SI ZE - 1) As Byte
Dim leftoversize As Long
Dim blnSendRequest As Boolean
nFileHandle = FreeFile
Dim sBuffer As String * 1024
Dim sBufferLength As Long
sBufferLength = Len(sBuffer)
hRequest = HttpOpenRequest (hConnect, "POST", "/Upload_Signatur e.asp", "HTTP/1.0", 0, 0, INTERNET_FLAG_N O_CACHE_WRITE, 0)
If hRequest = 0 Then
LastDllErrorInf o 'Call before calling any other dll function
If Not HttpErrorCode = 0 Then
Err.Raise HttpErrorCode, , HttpErrorString
End If
Exit Function
End If
Dim sData As String
sData = GetFileContents (localFileName)
If sData <> vbNullString Then
blnSendRequest = HttpSendRequest (hRequest, vbNullString, 0, sData, Len(sData))
Else
Exit Function
End If
'blnSendRequest = HttpSendRequest (hRequest, vbNullString, 0, localFileName, Len(localFileNa me))
bQueryInfo = HttpQueryInfo(h Request, HTTP_QUERY_CONT ENT_TYPE, sBuffer, sBufferLength, 0)
UploadFileHTTP = bQueryInfo
Close nFileHandle
InternetCloseHa ndle hRequest
End Function
I think I need Server side component(may be in ASP),but how to implement it?
Public Function UploadFileHTTP( ByVal localFileName As String, ByVal remoteFileName As String) As Integer
Dim nRet As Integer
Dim bRet, bQueryInfo As Boolean
Dim iRet As Integer
Dim nFileHandle, i As Integer
Dim bData(BUFFER_SI ZE - 1) As Byte
Dim leftoversize As Long
Dim blnSendRequest As Boolean
nFileHandle = FreeFile
Dim sBuffer As String * 1024
Dim sBufferLength As Long
sBufferLength = Len(sBuffer)
hRequest = HttpOpenRequest (hConnect, "POST", "/Upload_Signatur e.asp", "HTTP/1.0", 0, 0, INTERNET_FLAG_N O_CACHE_WRITE, 0)
If hRequest = 0 Then
LastDllErrorInf o 'Call before calling any other dll function
If Not HttpErrorCode = 0 Then
Err.Raise HttpErrorCode, , HttpErrorString
End If
Exit Function
End If
Dim sData As String
sData = GetFileContents (localFileName)
If sData <> vbNullString Then
blnSendRequest = HttpSendRequest (hRequest, vbNullString, 0, sData, Len(sData))
Else
Exit Function
End If
'blnSendRequest = HttpSendRequest (hRequest, vbNullString, 0, localFileName, Len(localFileNa me))
bQueryInfo = HttpQueryInfo(h Request, HTTP_QUERY_CONT ENT_TYPE, sBuffer, sBufferLength, 0)
UploadFileHTTP = bQueryInfo
Close nFileHandle
InternetCloseHa ndle hRequest
End Function