Solved

retrieving internet file

Posted on 1998-09-10
5
132 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

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 …
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 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…
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…

770 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