[Gambas-user] File Downloading
Shannon Kuchler
shannon at inflecto.org
Thu Mar 1 02:10:51 CET 2018
Total noobie here
I have searched and searched and can't seem to figure this out
I simply need to download a file
The problem is this code works when it feels like it. When it works it works great. When it doesn't work it just creates the temp.zip and does nothing.
It doesn't raise an error so I don't know what's going on.
On top of that I can't get it to download if the url is redirected
for example I want to download this file https://github.com/SphereII/SMXBigBackPack/archive/master.zip
but the url is redirected to https://codeload.github.com/ClockworkOrange420/7-Days-to-die-Unofficial-XML-Fixes/zip/master
Ideally I want to download master.zip from https://github.com/SphereII/SMXBigBackPack/archive/master.zip and save it to /tmp/mi4l/master.zip
Public hGetFileClient As New HttpClient As "hGetFileClient" Private sDownloadBuffer As String
Public Sub DownloadFile()
hGetFileClient.URL = URL
hGetFileClient.TimeOut = 0
hGetFileClient.Async = True
hGetFileClient.Get([], "/tmp/mi4l/" & "temp.zip")
end
Public Sub hGetFileClient_Error()
hGetFileClient.Stop()
Message("Error: Downloading")
End
Public Sub hGetFileClient_Finished()
Shell "unzip -o /tmp/mi4l/*.zip" & " -d " & "/tmp/mi4l/" Wait
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180228/d5a2dabc/attachment-0001.html>
More information about the User
mailing list