Solved

Simple Inet Upload File

Posted on 2004-08-14
2
1,773 Views
Last Modified: 2011-10-03
I am trying to upload a simple test file from my local hard disk to my server. I am using the following code:

Sub UploadFile()
 Inet1.RemoteHost = "ftp://www.abc.com"
 Inet1.UserName = "username"
 Inet1.Password = "password"
 Inet1.Protocol = icDefault  ' I have also tried http and ftp
 Inet1.Execute "www.abc.com", "PUT C:\junk\test.txt"
End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
Text1 = Text1 & State & vbCrLf
  If State = icResponseCompleted Then
   Text1 = Text1 & "Done"
  End If
End Sub

I get the following string of States : 1,2,3,4,5,6,7,8,12,Done

However, the file does not appear on my server. In fact, even if I change my username/password to garbage, it sill produces the same sequence of States. It is somehow ignoring my UN/PW and not ever really uploading anything.

I am able to use a WS_FTP to upload the file with no problems so I know my UN/PW are correct.

Please tell me what I am doing wrong?
0
Comment
Question by:deming
2 Comments
 
LVL 4

Accepted Solution

by:
ark4877 earned 500 total points
Comment Utility
0
 

Author Comment

by:deming
Comment Utility
Thank you. That link showed me how to fix my code. Here is the working code:

Sub UploadFile()
 Inet1.RemoteHost = "ftp://www.abc.com"
 Inet1.UserName = "username"
 Inet1.Password = "password"
 Inet1.URL = "ftp://username:password@www.abc.com"
 Inet1.Protocol = icFTP
 Inet1.Execute , "Put C:\junk\test.txt /username/abc.com/test.txt"
End Sub

Sub DownloadFile()
 Inet1.RemoteHost = "ftp://www.abc.com"
 Inet1.UserName = "username"
 Inet1.Password = "password"
 Inet1.URL = "ftp://username:password@www.abc.com"
 Inet1.Protocol = icFTP
 Inet1.Execute , "Get " & _
        "/username/abc.com/test.txt C:\junk\test1.txt"
End Sub
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now