PDA

View Full Version : INET download issue



nrodes
03-06-2009, 22:05
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.

ErosOlmi
03-06-2009, 22:17
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:


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")



Ciao
Eros