?
Solved

Simple Inet Upload File

Posted on 2004-08-14
2
Medium Priority
?
1,817 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 2000 total points
ID: 11801169
0
 

Author Comment

by:deming
ID: 11801625
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 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