Logo Search packages:      
Sourcecode: jftp version File versions  Download package

int net::sf::jftp::net::FtpConnection::handleUpload ( String  file,
String  realName 
) [inline]

Upload a file or directory. Uses multithreading if enabled and does not block.

Parameters:
file The file to upload
realName The file to rename the uploaded file to
Returns:
An int-statuscode, NEW_TRANSFER_SPAWNED,TRANSFER_FAILED or TRANSFER_SUCCESSFUL

Definition at line 1490 of file FtpConnection.java.

References getCachedPWD(), getLocalPath(), host, net::sf::jftp::net::FtpConstants::NEW_TRANSFER_SPAWNED, password, port, upload(), and username.

    {
        if(Settings.getEnableMultiThreading() &&
               (!Settings.getNoUploadMultiThreading()))
        {
            Log.out("spawning new thread for this upload.");

            FtpTransfer t;

            if(realName != null)
            {
                t = new FtpTransfer(host, port, getLocalPath(), getCachedPWD(),
                                    file, username, password, Transfer.UPLOAD,
                                    handler, listeners, realName, crlf);
            }
            else
            {
                t = new FtpTransfer(host, port, getLocalPath(), getCachedPWD(),
                                    file, username, password, Transfer.UPLOAD,
                                    handler, listeners, crlf);
            }

            lastTransfer = t;

            return NEW_TRANSFER_SPAWNED;
        }
        else
        {
            if(Settings.getNoUploadMultiThreading())
            {
                Log.out("upload multithreading is disabled.");
            }
            else
            {
                Log.out("multithreading is completely disabled.");
            }

            return (realName == null) ? upload(file) : upload(file, realName);
        }
    }


Generated by  Doxygen 1.6.0   Back to index