Solved

Simple Inet Upload File

Posted on 2004-08-14
2
1,776 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

813 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

16 Experts available now in Live!

Get 1:1 Help Now