shivang
Jun 2nd, 2008, 05:24 AM
hi everyone,
i can download simple files like "www.freevbcodes\networking\e-mail.com"
but cant download from download.com site may be for its link is not valid for my
download manager.
i put my code below
Public Function StartUpdate(strURL As String)
BytesAlreadySent = 1
If strURL = "" Then
'MsgBox "Enter the URL.", vbExclamation
Else
Image5.Visible = False
Image1.Visible = True
End If
URL = strURL
Dim Pos%, LENGTH%, NextPos%, LENGTH2%, POS2%, POS3%
Pos = InStr(strURL, "://") 'Record position of ://
LENGTH2 = Len("://") 'Record the length of it
LENGTH = Len(strURL) 'Length of the entire url
If InStr(strURL, "://") Then ' check if they entered the http:// or ftp://
strURL = Right(strURL, LENGTH - LENGTH2 - Pos + 1) ' remove http:// or ftp://
End If
'If InStr(strURL, "\") Then
'MsgBox "Invalid URL(\)."
'End If
If InStr(strURL, "/") Then 'looks for the first / mark going from left to right
POS2 = InStr(strURL, "/") 'gets the position of the / mark
'-----------------GET THE FILENAME-------------
Dim StrFile$: StrFile = strURL 'load the variables into each other
Do Until InStr(StrFile, "/") = 0 'Do the loop until all is left is the filename
LENGTH2 = Len(StrFile) 'get the length of the filename every time its passed over by the loop
POS3 = InStr(StrFile, "/") 'find the / mark
StrFile = Right(strURL, LENGTH2 - POS3) 'slash it down removing everything before the / mark including the / mark...
Loop
FileName = StrFile
'----------------END GET FILE NAME--------------
strSvrURL = Left(strURL, POS2 - 1) 'removes everything after the / mark leaving just the server name as the end result
End If
'-----------END TRIM THE URL FOR THE SERVER NAME-----------
End Function
Public Function Download()
StartUpdate Text1
End Function
pls help me
i can download simple files like "www.freevbcodes\networking\e-mail.com"
but cant download from download.com site may be for its link is not valid for my
download manager.
i put my code below
Public Function StartUpdate(strURL As String)
BytesAlreadySent = 1
If strURL = "" Then
'MsgBox "Enter the URL.", vbExclamation
Else
Image5.Visible = False
Image1.Visible = True
End If
URL = strURL
Dim Pos%, LENGTH%, NextPos%, LENGTH2%, POS2%, POS3%
Pos = InStr(strURL, "://") 'Record position of ://
LENGTH2 = Len("://") 'Record the length of it
LENGTH = Len(strURL) 'Length of the entire url
If InStr(strURL, "://") Then ' check if they entered the http:// or ftp://
strURL = Right(strURL, LENGTH - LENGTH2 - Pos + 1) ' remove http:// or ftp://
End If
'If InStr(strURL, "\") Then
'MsgBox "Invalid URL(\)."
'End If
If InStr(strURL, "/") Then 'looks for the first / mark going from left to right
POS2 = InStr(strURL, "/") 'gets the position of the / mark
'-----------------GET THE FILENAME-------------
Dim StrFile$: StrFile = strURL 'load the variables into each other
Do Until InStr(StrFile, "/") = 0 'Do the loop until all is left is the filename
LENGTH2 = Len(StrFile) 'get the length of the filename every time its passed over by the loop
POS3 = InStr(StrFile, "/") 'find the / mark
StrFile = Right(strURL, LENGTH2 - POS3) 'slash it down removing everything before the / mark including the / mark...
Loop
FileName = StrFile
'----------------END GET FILE NAME--------------
strSvrURL = Left(strURL, POS2 - 1) 'removes everything after the / mark leaving just the server name as the end result
End If
'-----------END TRIM THE URL FOR THE SERVER NAME-----------
End Function
Public Function Download()
StartUpdate Text1
End Function
pls help me