Solved

retrieving internet file

Posted on 1998-09-10
5
133 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
ID: 1434050
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
ID: 1434051
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
ID: 1434052
This is sort of a rush problem
0
 
LVL 14

Accepted Solution

by:
waty earned 250 total points
ID: 1434053
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
ID: 1434054
Thank You
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

860 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