Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Inet Control

Posted on 1998-08-20
3
Medium Priority
?
214 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 120 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 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…
Suggested Courses

963 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