Advertisement
ASP_Volume3 Internet/ HTML #56041

Internet File Transfer From Website

This is a module for easily adding the ability to transfer a file from a webserver to a hard drive. Good for a "live update" type of functionality or for downloading banners to your program. By Erick Jones, http://www.webdataconsultants.com

AI

Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Codice sorgente
original-source
'####################################
'# Created 2002 Webdata Consultants #
'# You are free to use this module #
'# as long as you keep this header #
'# intact.       #
'# www.webdataconsultants.com  #
'####################################
'
'First of all, to use this module you have
'add a Microsoft Internet Transfer Control
'and a Label1 Control to your form.
'
'EXAMPLE USAGE:
 'Label1.Caption = "Getting File..."
 'TransferFile = Xfer(Inet1, "http://www.webdata.addr.com/index.html", App.Path + "\index.html")
 'Label1.Caption = InetStatus
Global TransferFile As Boolean
Global b() As Byte
Global InetStatus As String
Public Function Xfer(Inet1 As Inet, strURL As String, InputFile As String) As Boolean
 On Error GoTo ErrorHandle
 Inet1.AccessType = icUseDefault
 Inet1.RequestTimeout = 10 'Higher number increases request timeout
 b() = Inet1.OpenURL(strURL, icByteArray)
 Open InputFile For Binary Access _
 Write As #1
 Put #1, , b()
 Close #1
 InetStatus = "Done"
Exit Function
ErrorHandle:
 Select Case Err.Number
  Case 75
   InetStatus = "Destination file is read-only."
  Case 35761
   InetStatus = "Request timed out. Please check your internet connection or try again later."
  Case Else
   InetStatus = "Error: " & Err.Number
 End Select
End Function
Commenti originali (3)
Recuperato da Wayback Machine