java - How to allow FTP Clients to create new directories on an Apache FTP Server in Android? -


i developing apache ftp server android app. able connect ftp server filezilla can't create new directories or upload datas on server , seems there doesn't exist directory though created one.

here's mainactivity.java file in declare ftp server , baseuser , set writepermission user:

package com.example.adminklui.server;  import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.view; import android.view.menu; import android.view.menuitem;   import org.apache.ftpserver.ftpserver; import org.apache.ftpserver.ftpserverfactory; import org.apache.ftpserver.ftplet.authority; import org.apache.ftpserver.ftplet.ftpexception; import org.apache.ftpserver.ftplet.usermanager; import org.apache.ftpserver.listener.listenerfactory; import org.apache.ftpserver.usermanager.propertiesusermanagerfactory; import org.apache.ftpserver.usermanager.saltedpasswordencryptor; import org.apache.ftpserver.usermanager.impl.baseuser; import org.apache.ftpserver.usermanager.impl.writepermission;  import java.io.file; import java.util.arraylist; import java.util.list;  public class mainactivity extends appcompatactivity {  @override protected void oncreate(bundle savedinstancestate) {     org.apache.log4j.basicconfigurator.configure();      super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar);     setsupportactionbar(toolbar);      propertiesusermanagerfactory usermanagerfactory = new propertiesusermanagerfactory();     usermanager usermanager = usermanagerfactory.createusermanager();     usermanagerfactory.setfile(new file("home/server/users.properties"));     usermanagerfactory.setpasswordencryptor(new saltedpasswordencryptor());      baseuser user = new baseuser();     user.setname("username");     user.setpassword("password");     user.sethomedirectory("/home/server/ftp/");      list<authority> authoritylist = new arraylist<authority>();     authority authority = new writepermission();     authoritylist.add(authority);      user.setauthorities(authoritylist);      try {         usermanager.save(user);     } catch (ftpexception e) {         e.printstacktrace();     }      ftpserverfactory serverfactory = new ftpserverfactory();      serverfactory.setusermanager(usermanager);     listenerfactory listenerfactory = new listenerfactory();     listenerfactory.setport(2221);     serverfactory.addlistener("default", listenerfactory.createlistener());      ftpserver server = serverfactory.createserver();     try {         server.start();     } catch (ftpexception e) {         e.printstacktrace();     } }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.menu_main, menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     // handle action bar item clicks here. action bar     // automatically handle clicks on home/up button, long     // specify parent activity in androidmanifest.xml.     int id = item.getitemid();      //noinspection simplifiableifstatement     if (id == r.id.action_settings) {         return true;     }      return super.onoptionsitemselected(item); } } 

here manifest.xml file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.adminklui.server" >  <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" />  <application     android:allowbackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:supportsrtl="true"     android:theme="@style/apptheme" >     <activity         android:name=".mainactivity"         android:label="@string/app_name"         android:theme="@style/apptheme.noactionbar" >         <intent-filter>             <action android:name="android.intent.action.main" />              <category android:name="android.intent.category.launcher" />         </intent-filter>     </activity> </application>  </manifest> 

and here build.gradle file:

apply plugin: 'com.android.application'  android { compilesdkversion 23 buildtoolsversion "23.0.1"  defaultconfig {     applicationid "com.example.adminklui.server"     minsdkversion 15     targetsdkversion 23     versioncode 1     versionname "1.0"      multidexenabled true } buildtypes {     release {         minifyenabled false         proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'     } } packagingoptions {     exclude 'meta-inf/notice'     exclude 'meta-inf/license'     exclude 'meta-inf/license.txt'     exclude 'meta-inf/spring.handlers'     exclude 'meta-inf/spring.schemas'  } }  dependencies {    testcompile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:23.1.0'    compile 'com.android.support:design:23.1.0'    compile filetree(dir: 'libs', include: ['*.jar']) } 

when want create new directory filezilla message in android studios logcat:

-org.apache.ftpserver.listener.nio.ftploggingfilter  - sent: 550 no such directory. 

have forgotten or ftp client not have permission create directories or upload files , why exists no directory on ftp server?

thanks , looking forward responses

f. klui


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -