I am creating OCX for Http Upload control.can anyone plz tell me why the function UploadFileHTTP returns 0 when used?I am posting my code----
[CODE=vb]
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
Dim szContent As String
nFileHandle = FreeFile
hRequest = HttpOpenRequest (hConnect, "POST", "192.168.3. 13/Fileupload/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
blnSendRequest = HttpSendRequest (hRequest, vbNullString, 0, localFileName, Len(localFileNa me))
bQueryInfo = HttpQueryInfo(h Request, HTTP_QUERY_CONT ENT_TYPE, remoteFileName, Len(remoteFileN ame), 0)
Close nFileHandle
InternetCloseHa ndle hRequest
End Function[/CODE]
[CODE=vb]
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
Dim szContent As String
nFileHandle = FreeFile
hRequest = HttpOpenRequest (hConnect, "POST", "192.168.3. 13/Fileupload/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
blnSendRequest = HttpSendRequest (hRequest, vbNullString, 0, localFileName, Len(localFileNa me))
bQueryInfo = HttpQueryInfo(h Request, HTTP_QUERY_CONT ENT_TYPE, remoteFileName, Len(remoteFileN ame), 0)
Close nFileHandle
InternetCloseHa ndle hRequest
End Function[/CODE]
Comment