Solved

FTP &The Internet Transfer control

Posted on 1998-10-08
5
159 Views
Last Modified: 2010-04-30
I've an application that is using "The Internet Transfer Control" to get a file from a Server. How can I know the SIZE of the file I'm getting and the time's estimation it will last?

Thank you for helping me!

                       Susana
0
Comment
Question by:raskia
5 Comments
 

Author Comment

by:raskia
ID: 1438868
Edited text of question
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1438869
Once you've established the connection, send an LS command. This will return the Unix equivalent of a DOS DIR command.

M

0
 

Author Comment

by:raskia
ID: 1438870
LS is not a valild operation when use "Internet transfer Control", so I can't use it.

0
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1438871
I assume this is FTP
my friend tried this once and it was a  joke....
much better to use the winsock control with FTP.. at least that work

0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 100 total points
ID: 1438872
Here is the help for the execute method. As you can see size is one of things that you can retrieve using this method of the internet transfer control

Executes a request to a remote server. You can only send requests which are valid for the particular protocol.

Syntax

object.Execute url, operation, data, requestHeaders

The Execute property syntax has these parts:

Part      Description
object      An object expression that evaluates to an object in the Applies To list.
url      Optional. String that specifies the URL to which the control should connect. If no URL is specified here, the URL specified in the URL property will be used.
operation      Optional. String that specifies the type of operation to be executed. See Settings below for a list of supported operations.
data      Optional. String that specifies the data for operations (See Settings below.)
requestHeaders      Optional. String that specifies additional headers to be sent from the remote server. The format for these is:header name: header value vbCrLf
Settings

Note   Valid settings for operation are determined by the protocol being used. The tables below are organized by protocol.

Supported HTTP commands

Valid settings for operation are:

Operation      Description
GET      Retrieve data from the URL specified in the URL property.
HEAD      Sends the Request headers.
POST      Posts data to the server. The data is located in the data argument. This is an alternate method to GET, for which additional instructions are specified in the data argument.
PUT      Put operation. The name of the page to be replaced is located in the data argument.
Supported FTP commands

Important   The FTP protocol uses a single string that includes the operation name and any other parameters needed by the operation. In other words, the data and requestHeaders arguments are not used; all of the operations and their parameters are passed as a single string in the operation argument. Parameters are separated by a space. In the descriptions below, do not confuse the terms "file1" and "file2” with the data and requestHeaders arguments.

The syntax for FTP operations is:
operationName file1 file2.
For example, to get a file, the following code invokes the Execute method, which includes the operation name ("GET"), and the two file names required by the operation:

Inet1.Execute "FTP://ftp.microsoft.com", _
"GET Disclaimer.txt C:\Temp\Disclaimer.txt"

Note   File names that include embedded spaces are not supported.

Valid FTP settings for operation are:

Operation      Description
CD file1      Change Directory. Changes to the directory specified in file1.
CDUP      Change to parent directory. Equivalent to "CD.."
CLOSE      Closes the current FTP connection.
DELETE file1      Deletes the file specified in file1.
DIR file1      Directory. Searches the directory specified in file1. (Wildcards are permitted but the remote host dictates the syntax.) If no file1 is specified, a full directory of the current working directory is returned.Use the GetChunk method to return the directory data.
GET file1 file2      Retrieves the remote file specified in file1, and creates a new local file specified in file2.
LS file1      List. Searches the directory specified in file1. (Wildcards are permitted but the remote host dictates the syntax.) Use the GetChunk method to return the file directory data.
MKDIR file1      Make Directory. Creates a directory as specified in file1. Success is dependent on user privileges on the remote host.
PUT file1 file2      Copies a local file specified in file1 to the remote host specified in file2.
PWD      Print Working Directory. Returns the current directory name. Use the GetChunk method to return the data.
QUIT      Terminates the current user.
RECV file1 file2      Retrieves the remote file specified in file1, and creates a new local file specified in file2. Equivalent to GET.
RENAME file1 file2      Renames the remote file named in file1 to the new name specified in file2. Success is dependent on user privileges on the remote host.
RMDIR file1      Remove Directory. Removes the remote directory specified in file1. Success is dependent on user privileges on the remote host.
SEND file1 file2      Copies a local file, specified in file1, to the remote host, specified in file2. Equivalent to PUT.
SIZE file1      Returns the size of the directory specified in file1.
Return Type

None

Remarks

Many commands listed above can be carried out only if the user has privileges on the host server. For example, anonymous FTP sites will not allow anyone to delete files or directories.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

749 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