Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

retrieving internet file

Posted on 1998-09-10
5
Medium Priority
?
138 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 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

963 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