Ftp Object : Allocate Property |
Visual Basic |
---|
Public Property Allocate As Boolean |
The default value is False.
You can set this property at design time. Some servers may require its use. When set to True, an ftpAllocate command is sent with the proper file size before starting a file transfer.
Private Sub cmdAllocateAndSend_Click() ' set up a trace file so we can see if the Allocate command is successful Ftp1.Trace "c:\ftpfiles\trace.txt", True, True, "Client: ", "Server: " ' login to ftp server Ftp1.Login "www.testserver.com", "Administrator", "123456" ' setting this will cause ftpAllocate command to be sent with the data Ftp1.Allocate = True ' sore the file, if supported, an ftpAllocate command, followed with the file ' size, will be sent before the transfer so the server can allocate space Ftp1.Store "testfile1.EXE", "C:\ftpfiles\testfile1.EXE" MsgBox "done" Ftp1.Logout End Sub 'Now if we check the trace file we created, we see the client sent the allocate command and the file size before transferring: 'Server: 220 SERVER88 Microsoft FTP Service (Version 5.0). 'Client: USER Administrator 'Server: 331 Password required for Administrator. 'Client: PASS 123456 'Server: 230 User Administrator logged in. 'Client: ALLO 328500 'Server: 200 ALLO command successful. 'Client: PASV 'Server: 227 Entering Passive Mode (209,61,190,88,16,127). 'Client: STOR 45P_W32_2.EXE 'Server: 125 Data connection already open; Transfer starting. 'Server: 226 Transfer complete. 'Client: QUIT 'Server: 221