I need to upload images to an IIS webserver using HTTP POst. I read that Winsock and INet controls can do that. But I am at a total loss. I have been trying for the past 2 weeks and I am not getting it.
Can anyone please post the code they have for doing this. I tried the following code, but it doesnt upload the file, it just copies it. The server might necessarily allow access to its drives, so my copying code wont work... Please some help. Below is the code I used. Please if someone has a method with Winsock or with something else which uses HTTP POst... It will be great.
Inet1.Protocol = icHTTP
Inet1.AccessType = icUseDefault
Inet1.URL = "http://IP:PORT/clerical.cfm
Dim strSourceFile As String
strSourceFile = SubDir(m) & "\" & FileToUpload
Dim fl As Long
Dim binbyte() As Byte
Dim readBinFile() As Byte
Dim FileNo As Long
FileNo = FreeFile()
Open strSourceFile For Binary Access Read As #FileNo
fl = FileLen(strSourceFile)
Get #FileNo, , binbyte
Dim FileNum As Long
Dim strServerDirPath, strSubServerDirPath As String
strServerDirPath = "\\IP\C$\Data\patients\" & strServerFolder
strSubServerDirPath = strServerDirPath & "\" & strSubServerFolder
FileNum = FreeFile
Open strSubServerDirPath & "\" & FileToUpload For Binary Access Write As #FileNum
'Put data into the image
Put #FileNum, , binbyte
MsgBox "Image " & FileToUpload & " Uploaded."
Do While Inet1.StillExecuting
I also looked at http://www.vbforums.com/showthread.php?t=337424
, but it doesnt upload any images to the server.
Any kind of help will be extremely appreciated.