dimanche 6 décembre 2020

Access denied due to FTP file upload

I'm preparing automated tests. Firstly I try to upload file into my FTP. I prepared following methods.

public void uploadFTPFile(String localFileName, String fileName, String hostDir) throws Exception {
            try {
                InputStream input = new FileInputStream(new File(localFileName));
                this.ftp.storeFile(hostDir + fileName, input);
            }
            catch (IOException e) {
            }
        }

public static void main(String[] args) throws IOException {
        try {
            FTPFunctions ftpobj = new FTPFunctions("host", 21, "username", "password");
            ftpobj.uploadFTPFile("D:\\all\\test\\test\\test_files\\", "file1.csv", "/test/");
            boolean result = ftpobj.FTPFilesList("/dpd", "file1.csv");
            //System.out.println(result);
            ftpobj.disconnect();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

After execute I received logs. Connection to ftp is working.

FTP ULR is: 21
USER user
331 Please specify the password.
PASS xxxx
230 Login successful.
TYPE L
500 Unrecognised TYPE command.
    java.io.FileNotFoundException: D:\\all\\test\\test\\test_files\\ (access denied)

This is a problem with access to this path? I checked security bookmark in this path and all permissions are enabled.

Aucun commentaire:

Enregistrer un commentaire