Solved

retrieving internet file

Posted on 1998-09-10
5
130 Views
Last Modified: 2010-04-30
I cannot get my code right.  I am trying to take a file that is on a local internet server and place it in a file on my C: drive.  I am able to post a file from my PC to the internet server, but not vice versa.  I am confused with all the Get, Put, OpenURL, etc. statements.  Code would be very useful.
0
Comment
Question by:timpeters
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:waty
Comment Utility
Here is the way :

' Retrieve latest software update from ftp.mycompany.com.

Dim bFile() as Byte         ' Retrieving a binary file.

' Retrieve the file.
bFile() = icTransfer.OpenURL _
    ("ftp://ftp.mycompany.com/upgrade/software.exe", _
    icByteArray)

' Write file to disk.
Open "C:\INTERNET\software.exe" For Binary Access Write As #1
Put #1, , bFile()
Close #1

0
 

Author Comment

by:timpeters
Comment Utility
I am not supposed to use ftp.  I know there is another way.  I am able to post this file to my local internet server without ftp.  I will give you an extra 50 points if you can help.  Thanks.  

To post it, I connected my internet transfer control, called INET1, to my server. I used the this in conjunction with a "INET1.Execute, 'PUT', data1" statement, where data1 was my file. I don't know if this helps.
0
 

Author Comment

by:timpeters
Comment Utility
This is sort of a rush problem
0
 
LVL 14

Accepted Solution

by:
waty earned 250 total points
Comment Utility
By doing this (using OpenUrl), you will not use FTP, you open directly the URL and save it.

If you want to use FTP you should do as follow :

icMain.Execute sURL, "CD " & m_rstSites("Directory")
zsWaitForResponse

icMain.Execute sURL, "USER " & icMain.UserName & " " & icMain.Password
zsWaitForResponse

icMain.Execute sURL, "CD " & m_rstSites("Directory")
zsWaitForResponse

icMain.Execute sURL, "GET aFile " & sFileName    zsWaitForResponse




Sub zsWaitForResponse()

' After executing an FTP command, we have to wait for it to complete
' before we undertake any further processing.

Do Until Not icMain.StillExecuting
    DoEvents
    ' We can do other things here.
Loop

End Sub

0
 

Author Comment

by:timpeters
Comment Utility
Thank You
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 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

13 Experts available now in Live!

Get 1:1 Help Now