ssCore.FTP.getFileSize

Find out how much data will be transferred before starting the transfer (for accurate progress reporting).


Availability:

First available in version 3.0 build 2039.


Input Parameters:

None.


Output Parameters:

result - The size of the file to be transferred. Possible return values are values are "-1" (length unknown) or a positive value that is the length in bytes of the file identified by FTP.localFile (for uploads) or FTP.remoteFile (for downloads).


Asynchronous Mode:

When this method is called asynchronously, a return object containing the output parameters is passed to the specified callback function.

ssCore.FTP.getFileSize( paramsObject [, callbackParamsObject] [, errorParamsObject] );


Synchronous Mode:

When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.

var returnObject = ssCore.FTP.getFileSize( paramsObject );


Notes:

The variable identified by result will contain the size of the file to be transferred, in bytes. Possible return values are values are "-1" (length unknown) or a positive value that is the length in bytes of the file identified by FTP.localFile (for uploads) or FTP.remoteFile (for downloads). The file size information is only available after calling FTP.open.

If the number of bytes returned is "-1", the content length is unknown. This should only happen when performing downloads. You can still proceed and call FTP.transfer if the file size is "-1", it just means that the server can't provide the byte count and you won't be able to provide accurate progress indicators.

If FTP.getFileSize returns "-1", you can use the value returned by FTP.getDirList or FTP.getXMLDirList.

                

Examples:

var return_obj = ssCore.FTP.getFileSize();

ssDebug.trace(return_obj.result);