[Gambas-user] How to download a file?

Willy Raets willy at ...2734...
Wed Apr 4 00:44:54 CEST 2012


Try this:

Dim sSourcePath, sCopyPath As String
sSourcePath = "http://mydomain/test"
sCopyPath = User.Home & "/Test"
If Not(Exist(sCopyPath) Then
   MKDIR sCopyPath
Endif
sCopyPath = sCopyPath & "/test"
If Exist(sCopyPath) Then
   KILL sCopyPath
Endif
DownloadFile(sSourcePath)


PUBLIC SUB DownloadFile(sURL AS String)

  hGetFileClient.URL = sURL
  hGetFileClient.TimeOut = 5
  hGetFileClient.Async = TRUE
  hGetFileClient.Get(User.Home & "/Test/test")

END

PUBLIC SUB hGetFileClient_Error()

  hGetFileClient.Stop()

END

PUBLIC SUB hGetFileClient_Finished()

  hGetFileClient.Stop()

END



On ma, 2012-03-26 at 14:25 -0700, abbat wrote:
> I have a file on:
> www.mydomain.com/test
> 
> I tried :
> 
> 
> sSourcePath = "http://mydomain" 
> sCopyPath = User.Home & "/Test/" 
> Copy sSourcePath & "test" To sCopyPath & "test" 
> 
> but "File or Directory does not exist"
> 
> How to download a file?
> Thanks






More information about the User mailing list