CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2001
    Location
    Holland
    Posts
    3

    downloading from http

    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


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: downloading from http

    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
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    May 1999
    Posts
    87

    Re: downloading from http

    I have tried the code you suggested and it seems to work fine--do you also have the code for an upload??


  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: downloading from http

    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
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured