[Gambas-user] How to download a file?

Willy Raets willy at ...2734...
Wed Apr 4 01:49:44 CEST 2012


On wo, 2012-04-04 at 00:44 +0200, Willy Raets wrote:
> 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)
> 

Forgot one line of code that needs to go here:

PUBLIC hGetFileClient AS NEW HttpClient AS "hGetFileClient"

> 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
> 
> 
> 
> ------------------------------------------------------------------------------
> Better than sec? Nothing is better than sec when it comes to
> monitoring Big Data applications. Try Boundary one-second 
> resolution app monitoring today. Free.
> http://p.sf.net/sfu/Boundary-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user






More information about the User mailing list