Click to See Complete Forum and Search --> : downloading from http


Sebsoft
April 13th, 2001, 05:34 AM
I am looking for a easy way to download files from http://www.infoplace.nl/files/... (the site is NOT online now).
I've tried the inet control but i cant make it work the way it should, i also tried UrlToDownload file but that keep giving me a byref error because it doesnt support variables (i think).
So if anyone has a solution, please speak out.
Thanks in advance,

Sebastian

Iouri
April 13th, 2001, 07:10 AM
Try this

Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long



Private Sub cmdSave_Click()
Call URLDownloadToFile(0, "http://www.somesite.com/file.exe", _
"c:\path\file.exe", 0, 0)
End Sub


Iouri Boutchkine
iouri@hotsheet.com

Rog
February 13th, 2002, 06:44 AM
I have tried the code you suggested and it seems to work fine--do you also have the code for an upload??

Iouri
February 13th, 2002, 06:52 AM
Check it out, but I did not try this.

Here is a solution in VB using the INet control.


Dim oFileSystem as new Scripting.FileSystemObject

s = "-----------------------------AaB03x" & vbCrLf & _
"content-disposition: form-data; name=""field1""; filename=""autoexec.bat""" & vbCrLf & _
"Content-Type: text/plain" & vbCrLf & vbCrLf & _
oFileSystem.GetFile("c:\autoexec.bat").OpenAsTextStream.ReadAll & _
"-----------------------------AaB03x--"
Inet1.Execute "<http://localhost/sample1.asp>", _
"POST", s, "Content-type: multipart/form-data, boundary=AaB03x"






Iouri Boutchkine
iouri@hotsheet.com