sbennetts
asked on
Using the Internet Transfer Control to upload a file
I'm trying to use the Internet Transfer Control to upload a file using HTTP.
I know there are plenty of easier ways of achieving this via FTP, but I don't want to have to configure my server as an FTP server. I have the following code
Dim strURL As String
Dim intFile As Integer
Dim tmpPhoto() As Byte
intFile = FreeFile()
strURL = "http://10.1.200.192/sb.htm"
Inet1.Execute strURL, "PUT", "c:\simon.htm"
If I execute this, my new file is copied to my web server at 10.1.200.192 but the new file contains "c:\simon.htm" rather than the actual file!
If I use the following code...
Dim strURL As String
Dim intFile As Integer
Dim tmpPhoto() As Byte
intFile = FreeFile()
strURL = "http://10.1.200.192/sb.htm"
Open "c:\simon.htm" For Binary Access Read As #intFile
Get #intFile, , tmpPhoto()
Close #intFile
Inet1.Execute strURL, "PUT", tmpPhoto()
If I run this, it falls over telling me it 'Cannot coerce type' with a runtime error 35760.
How can I perform this simple task?
Thanks
Simon.
I know there are plenty of easier ways of achieving this via FTP, but I don't want to have to configure my server as an FTP server. I have the following code
Dim strURL As String
Dim intFile As Integer
Dim tmpPhoto() As Byte
intFile = FreeFile()
strURL = "http://10.1.200.192/sb.htm"
Inet1.Execute strURL, "PUT", "c:\simon.htm"
If I execute this, my new file is copied to my web server at 10.1.200.192 but the new file contains "c:\simon.htm" rather than the actual file!
If I use the following code...
Dim strURL As String
Dim intFile As Integer
Dim tmpPhoto() As Byte
intFile = FreeFile()
strURL = "http://10.1.200.192/sb.htm"
Open "c:\simon.htm" For Binary Access Read As #intFile
Get #intFile, , tmpPhoto()
Close #intFile
Inet1.Execute strURL, "PUT", tmpPhoto()
If I run this, it falls over telling me it 'Cannot coerce type' with a runtime error 35760.
How can I perform this simple task?
Thanks
Simon.
ASKER
That works for a text/htm file, but I want to use it to upload JPG files
ASKER
I'm managed to do it, can I not sort it myself and get my points back :-(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
dim tmpPhoto as string