Results 1 to 2 of 2

Thread: INET download issue

  1. #1

    INET download issue

    I need to make a program that will download a file from the web and save it to a specific location. I am currently trying to do this with

    USES "INET"
    INET_downloadURL ("http://www.najsite.com/file.txt", "C:\Documents and Settings\All Users\Desktop\file.txt)
    
    It does not seem to work. What's wrong? Should I use a different command?
    Thanks in advance.

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,779
    Rep Power
    10

    Re: INET download issue

    Hi nrodes,

    few things to help you:
    • correct function to use is INET_URLdownload
    • in your line, one " is missing at the end
    • never hard code windows directory, they can be different from what you expect due to many factors. Instead always use OS_GetSpecialFolder with correct equate
    • possibly be sure source file exists


    Here a working script that should give you a go:
    [code=thinbasic]
    USES "INET"
    uses "OS"

    '---Determine which is the correct common desktop directory
    dim sCommonDesktop as string
    sCommonDesktop = OS_GetSpecialFolder(%CSIDL_COMMON_DESKTOPDIRECTORY )

    '---Download the file
    INET_URLdownload ("http://community.thinbasic.com/robots.txt", sCommonDesktop & "file.txt")

    [/code]

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Similar Threads

  1. timer / doevents / inet problem
    By martin in forum INet
    Replies: 23
    Last Post: 09-06-2009, 13:42

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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