Is it possible to upload image files to the ftp server through'processing'?

Is it possible to upload image files to the ftp server through’processing’?

  1. Select a picture stored on the smartphone.

  2. I want to transfer the saved picture to the ftp server.

Is there a method or sample code? Help.

import it.sauronsoftware.ftp4j.FTPClient;
import it.sauronsoftware.ftp4j.FTPDataTransferListener;
import java.io.File;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import android.os.Environment;

static final String FTP_HOST= “…”;
static final String FTP_USER = “…”;
static final String FTP_PASS ="…";
String my_folder = “TEST_FTP”;

PImage photo;
void setup(){

int Start_ms = millis();
fullScreen();
String link = Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+my_folder+"/1.jpg";
println(" LINK1 : " + link);
link = “/storage/emulated/0/2.png”; photo = loadImage(link);

// link = Environment.getExternalStorageDirectory()+“1.jpg”;
// println(" LINK2 : " + link);

File f = new File(link);
uploadFile(f);
println(" ms : " + str(millis()-Start_ms) );

}

void draw(){

if( photo != null ) { image(photo,0,0); }

}

public void uploadFile(File fileName){         
     
     FTPClient client = new FTPClient();
      
    try {
         
        client.connect(FTP_HOST,21);
        client.login(FTP_USER, FTP_PASS);
        client.setType(FTPClient.TYPE_BINARY);
        // client.changeDirectory("/upload/");
         
        client.upload(fileName, new MyTransferListener());
         
    } catch (Exception e) {
        e.printStackTrace();
        try {
            client.disconnect(true);    
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }
     
}
 
public class MyTransferListener implements FTPDataTransferListener {

    public void started() {
         
        System.out.println(" INIT" );
        
    } 
    public void transferred(int length) {
        System.out.println(" transferred" );
    } 
    public void completed() {
        System.out.println(" completed" );
    } 
    public void aborted() {

        System.out.println(" aborted" );
    } 
    public void failed() {

        System.out.println(" failed" );
    }

}

I solved it.