Solved

Inet Control

Posted on 1998-08-20
3
206 Views
Last Modified: 2009-12-16
I am making a app which will upload files to a server. How can i list whats in a dir on the users hardrive and whats in the servers dir? i'd like the user to be able to drag a file from his/her file list box to the servers, then click upload and it will upload. How?
0
Comment
Question by:jmharr
3 Comments
 
LVL 12

Expert Comment

by:mark2150
ID: 1430102
You can show off whats on the users drive with the SHOWOPEN option of the CommonDialog control or you could repeatedly use the DIR() command to populate a data structure of your own choosing.

I believe that the LS command will respond with a list of the available files on the host side of things. Again, you would capture the data and populate the matching data structure.


0
 

Author Comment

by:jmharr
ID: 1430103
i have no idea on doign any of that, and remember! i need to be able to drag it to the servers side and press upload and it will upload
0
 
LVL 14

Accepted Solution

by:
waty earned 60 total points
ID: 1430104
There is a function I use in one of my project to retreive the file on the server. You have to add the drag and drop parts.
See your other question for more code

Sub FTPWaitForResponse()
   ' *** After executing an FTP command, we have to wait for it to complete
   ' *** before we undertake any further processing.

   Do Until Not Inet.StillExecuting
       DoEvents
   Loop

End Sub

Private Sub Inet_StateChanged(ByVal State As Integer)
   ' *** State change in the connection
   
   Dim sTmp          As String
   
   Select Case State
      Case icError
         If (Inet.ResponseCode <> 0) And (Inet.ResponseCode <> 12003) Then
            Log "Connection Error : " & Inet.ResponseCode & ", Error : " & Inet.ResponseInfo, LOG_TYPE_ERROR
        End If
       
      Case icResponseCompleted ' 12
         sTmp = FTPGetText()
         
   End Select
   
End Sub

Function FTPGetText() As String
   ' *** Retrieve any text data that the remote sever has returned to us.
     
    Dim vChunk As Variant
    Dim sData  As String
    Dim bDone  As Boolean

    bDone = False
    vChunk = Inet.GetChunk(256)
    Do Until bDone
        sData = sData & vChunk
        vChunk = Inet.GetChunk(256)
        If Len(vChunk) = 0 Then
            bDone = True
        End If
    Loop
     
    FTPGetText = sData
    Debug.Print sData
     
End Function

Sub GetFileList(sDirectory As String, asFiles)

   ' This function will fill the array 'asFiles' with the directory
   ' entries that have been returned as part of the sDirectory string.
   
   Dim i          As Integer
   Dim iLastIndex As Integer
   
   iLastIndex = 0
   
   Do Until Len(sDirectory) = 0
      For i = 1 To Len(sDirectory)
         If Mid$(sDirectory, i, 1) = Chr$(13) Then
            If Len(sDirectory) <= 2 Then
               sDirectory = "" 
               Exit For
            End If
             
            ReDim Preserve asFiles(iLastIndex)
            asFiles(iLastIndex) = Left$(sDirectory, i - 1)
            iLastIndex = iLastIndex + 1
            sDirectory = Mid$(sDirectory, i + 2)
            Exit For
         
         End If
      Next
   Loop
   
End Sub
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to open Waze.com/livemap from address saved in DB? 26 178
Updates not working for MS Windows 7 12 154
Visual Studio 2005 text editor 10 35
Child Form in front 4 39
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now