Solved

Simple Inet Upload File

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How does CurrentUser work? 10 31
using web browser with BING 40 110
How to make an ADE file by code? 11 80
TT Auto Dashboard 13 85
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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…

895 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

19 Experts available now in Live!

Get 1:1 Help Now