Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't create directory on FTP server
    primarykey
    data
    text
    <p>I am trying to build an FTP server/client embedded in java using FTPServer Apache. After logging into the server, I need to create a directory on the server in order to start the upload(or that's what I understand I should do at least). The server side is working well so far. But it doesn't seem to work. Can you see something that I overlooked? Thank you</p> <p>The client's code:</p> <pre><code> package client; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; import org.apache.commons.net.ftp.FTPConnectionClosedException; class ftp{ public static void main(String[] args) throws IOException { FTPClient client = new FTPClient(); FileInputStream fis = null; boolean result; String ftpServerAddress="192.168.171.133"; String userName="iman"; String password="iman"; try { client.connect(ftpServerAddress, 1959); result = client.login(userName, password); if (result == true) { System.out.println("Successfully logged in!"); } else { System.out.println("Login Fail!"); return; } //Changing the working directory result=client.makeDirectory("/home/Serveur/workspac"); if(result==true){ System.out.println("New Directory is created on Ftp Server!"); } else{ System.out.println("Unable to create new directory!"); } client.setFileType(FTP.BINARY_FILE_TYPE); File file = new File("/home/client/workspace/Client/dos"); String testName = file.getName(); fis = new FileInputStream(file); int c= client.getReplyCode(); System.out.println(c); // Upload file to the ftp server result = client.storeFile(testName, fis); //result= client.remoteStore(testName); if (result == true) { System.out.println("File is uploaded successfully"); } else { System.out.println("File uploading failed"); } client.logout(); } catch (FTPConnectionClosedException e) { e.printStackTrace(); } finally { try { client.disconnect(); } catch (FTPConnectionClosedException e) { System.out.println(e); } } } } </code></pre> <p>The output is like this :</p> <pre><code>Successfully logged in! Unable to create new directory! 200 File uploading failed </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload