File Transfer Examples
You can refer to the following examples to configure the SIFTSingleFileTransfer class for transferring a file.
Uploading a file to a Server
import com.tibco.cfcc.fileTransferApplet.nongui.*; … //create an instance and set parameters SIFTSingleFileTransfer xfr = new SIFTSingleFileTransfer(); xfr.setFileTransferServletURL(“location of file transfer servlet”); xfr.setTransferDirection(“SEND”); // it is an upload file per file record xfr.setFileID(“file id”); // the file id in the file record xfr.setSessionID(“session id”); // the current session id from server xfr.setCompression(“YES or NO”); // depending value in file record xfr.setUser id(“user who initiates the transfer”); xfr.setPassword(“user’s password”); //transfer the file xfr. transferSingleFile(); //get result int rc=xfr.getReturnCode(); long bytes=xfr.getBytesTransfered(); long cbytes=xfr.getCompressedByte(); String msg=xfr.getReturnMsg();
Downloading a file from a Server’s Directory
… import com.tibco.cfcc.fileTransferApplet.nongui.*; … //create an instance and set parameters … same as example 1, except xfr.setTransferDirection(“RECEIVE”); // it is a download file per file record xfr.setServerFileName(“file name to be downloaded”); //only for directory download //transfer the file … same as example 1 //get result … same as example 1
Copyright © 2021. Cloud Software Group, Inc. All Rights Reserved.