CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Upload files to FTP Server

    How can I upload files to an FTP Server (with VB). Please help me in depth because I am begginer with Internet :-(

    Mi

  2. #2
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Found something...

    I found a good OCX on this site:
    http://ftp.devpower.com/
    Let's try it...%

  3. #3
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Found something...

    You could download my free class modules that I posted onto the CodeGuru site at http://www.codeguru.com/vb/articles/1852.shtml

    These will let you FTP files from VB.



    Chris Eastwood

    CodeGuru - the website for developers
    http://www.codeguru.com/vb

  4. #4
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Thanx anyway...

    The ocx I found was a better one because it lets you create directories. Thanx anyway...

    Michael Vlastos
    Company MODUS SA
    Development Department
    Athens, Greece
    Tel: +3-01-9414900

  5. #5
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Thanx anyway...

    The WinInet.DLL allows you to create a directory on the server, you'd need to place a new declare in the code -

    The C Declaration is :

    BOOLAPI
    FtpCreateDirectoryA(
    IN HINTERNET hConnect,
    IN LPCSTR lpszDirectory
    );




    or for unicode


    BOOLAPI
    FtpCreateDirectoryW
    IN HINTERNET hConnect,
    IN LPCWSTR lpszDirectory
    );




    It should be pretty easy to translate these into the relevant vb declarations and then add the methods into the class - and all for FREE !




    Chris Eastwood

    CodeGuru - the website for developers
    http://www.codeguru.com/vb

  6. #6
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Ok thank you!

    I'll try both and select the better one. Thanx Chris one more time...

    Michael Vlastos
    Company MODUS SA
    Development Department
    Athens, Greece
    Tel: +3-01-9414900

  7. #7
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Ok thank you!

    In fact, I've already converted that declare and tested it here - works fine.

    Place the following 'declare' in the cFTP class :


    private Declare Function FtpCreateDirectory Lib "wininet.dll" Alias "FtpCreateDirectoryA" _
    (byval hFtpSession as Long, byval lpszDirectory as string) as Boolean




    Then place a routine similar to this one in the cFTP class :


    public Function CreateDirectory(byval sDirectory as string) as Boolean

    on error GoTo vbErrorHandler

    Dim bRet as Boolean

    If mlConnection = 0 then
    on error GoTo 0
    Err.Raise errNotConnectedToSite, "CGFTP::GetFile", ERRNOCONNECTION
    End If

    bRet = FtpCreateDirectory(mlConnection, sDirectory)

    If bRet = false then
    '
    ' couldn't create directory - add extra errors to the class
    ' to handle this
    '
    End If

    CreateDirectory = bRet

    Exit Function

    vbErrorHandler:
    Err.Raise Err.Number, "cFTP::CreateDirectory", Err.Description

    End Function







    Chris Eastwood

    CodeGuru - the website for developers
    http://www.codeguru.com/vb

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