VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get files off of the web easily with this sub (uses Inet Control)

by BP (8 Submissions)
Category: Internet/HTML
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (9 Votes)

This sub will allow you to downloaded files off of the web by making one call. The syntax will look sometime to this effect:
Call GetInternetFile(Inet1, "https://www.fakeURL.com/~yup/picture.jpg", "c:\temp")

Assumes
For this sub to work you need to have an Inet control placed onto your form. After that it's just a matter of calling it.

Rate Get files off of the web easily with this sub (uses Inet Control)

Public Sub GetInternetFile(Inet1 As Inet, myURL As String, DestDIR As String)
' Written by: Blake Pell
Dim myData() As Byte
If Inet1.StillExecuting = True Then Exit Sub
myData() = Inet1.OpenURL(myURL, icByteArray)
For X = Len(myURL) To 1 Step -1
  If Left$(Right$(myURL, X), 1) = "/" Then RealFile$ = Right$(myURL, X - 1)
Next X
myFile$ = DestDIR + "\" + RealFile$
Open myFile$ For Binary Access Write As #1
  Put #1, , myData()
Close #1
End Sub

Download this snippet    Add to My Saved Code

Get files off of the web easily with this sub (uses Inet Control) Comments

No comments have been posted about Get files off of the web easily with this sub (uses Inet Control). Why not be the first to post a comment about Get files off of the web easily with this sub (uses Inet Control).

Post your comment

Subject:
Message:
0/1000 characters