How to download a file and save it

Discussion in 'Questions (Windows Mobile)' started by halo, Feb 13, 2009.

  1. halo

    halo Member Licensed User

    Sorry about my broken english.
    The main reason why I bought Basic4PPC is,every day I want to download a file from the internet and save it on my HTC Touch Diamond.

    To get startet with basic4ppc I need your :sign0085:
    I think I have to use the HTTP library.

    For example I want to download this file:

    Could you please give me an example for downloading this file.

    Best regards
    Halo :sign0104:
  2. Mr_Gee

    Mr_Gee Active Member Licensed User

    Welcome to B4PPC and the forum...

    As for your request, have you seen the help files?
    if you look at this page (and scroll down a bit)
    you will see the download sub
  3. halo

    halo Member Licensed User

    Thank you Mr_Gee
    With this code I can download the File:
    Sub Globals
    Dim Buffer(0As byte
    End Sub

    Sub App_Start
          URL = 
          DownloadFile(AppPath & 
    End Sub

    Sub DownloadFile (LocalFile,URL)
          Response.Value = Request.GetResponse 
    'Launch the request and get the response.
          Msgbox("Download size: " & Response.ContentLength) 'Show the file size.
          Reader.New1(Response.GetStream,True'Use a BinaryFile object to read the data from the Response stream.
    Dim buffer(4096As byte
          count = Reader.ReadBytes(buffer(),
    Do While count > 0
                count = Reader.ReadBytes(buffer(),
    'Close the Response stream.
          Msgbox("File saved.")
    End Sub
    I did not understand very much of this code, but it runs.
    I saw this example bevor. But I have very much problems with understanding wich object i have to add. Sorry for my dopyness.

    Thank you very much for your help.

    Greets Halo
  4. Mr_Gee

    Mr_Gee Active Member Licensed User

    yes thats the one..

    I understand it can be a bit overwhelming at first, but when you are working with the application for a while you will get accustomed to it...

    my advise start with the tutorials, the are really good
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice