Solved

Inet Control

Posted on 1998-08-20
3
210 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adding to a VBA? 6 78
Excel VBA, find a string in a column, update a cell 7 87
Prevent checkbox click event occur while editing it in vb6 8 57
vbModal 12 57
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

820 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