Results 1 to 8 of 8

Thread: checking file on internet

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Location
    Brisbane
    Posts
    106

    checking file on internet

    hey all,

    wat im trying to do is get my program to check if the version it has is the newest.

    my theory is - have 2 files, one the setup file the other a text file.
    if the textfile name = the text in the curV.txt file then nuthing, otherwise download. can u please help me on this,

    btw, the 2 files (setup.exe and textfile are on the net)

  2. #2
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    What exactly are you having trouble with?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Location
    Brisbane
    Posts
    106
    i have no idea where to start?

  4. #4
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918
    Try this. You need a form with an Internet Transfer Control called inetDownload on it.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.  
    5.     DownLoadFromURL "http://www.yourwebsite.com/files/", "filetodownload.txt"
    6.     Unload Me
    7.    
    8. End Sub
    9.  
    10. Private Sub DownLoadFromURL(ByVal url As String, ByVal filename As String)
    11.     '
    12.     '   Download a file from a given URL
    13.     '
    14.     Dim bytes() As Byte
    15.     Dim fnum As Integer
    16.     Dim ftext As String
    17.     '
    18.     ' Download the file and load into byte array
    19.     '
    20.     ftext = url & filename
    21.     bytes() = inetDownload.OpenURL(ftext, icByteArray)
    22.  
    23.     fnum = FreeFile
    24.     '
    25.     '   Write the downloaded file to disk
    26.     '
    27.     Open App.Path & "\" & filename For Binary Access Write As #fnum
    28.    
    29.     Put #fnum, , bytes()
    30.     Close #fnum
    31.    
    32. End Sub
    This will download the file for you, what you do with the file is up to you.

    Good luck
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    that inspires me to write an app for my dad. his golf club posts a new handicap file every week to be used by an app that they gave him. i have to go over there every week to get it for him. if i can teach him to run this app while he's online, then it'll get the new file without my help. brillant!

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Location
    Brisbane
    Posts
    106
    pnish u are a guiniuss (srry dont know spelling)

    thank u soo much

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Location
    Brisbane
    Posts
    106
    man i couldent express myself in the last one.

    THANK U SOOOOOO MUCH U LEGEND!!!!

    U ARE A TOTAL LIFESAVER!

  8. #8
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918
    Jeez!! You've made me blush

    By the way, you're welcome.
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width