Solved

Simple Inet Upload File

Posted on 2004-08-14
2
1,779 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

733 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