Hi , Even i faced the same problem . But when i try to do FTP to another machine , it went through fine . Try to setup FTP server in another system in same LAN and test it . It worked for me . If u try to do FTP to local machine 10.0.2.2 , internally it will point to look loopback address 127.0.0.1 . So try to give IP of another machine and try.
Hope this will be helpful. On Mar 14, 7:05 pm, Miguel Morales <[email protected]> wrote: > Well the first issue is that you are making a network request on the main UI > thread. > This will block the thread until the network operation completes and might > make your program close. > > I suggest you start by reading > this:http://developer.android.com/guide/topics/fundamentals/processes-and-... > > You also haven't told us what kind of error you are getting and what > behavior you are seeing on the ftp server itself. > > > > On Sat, Mar 12, 2011 at 5:16 AM, dappa <[email protected]> wrote: > > I have quite simple sounding task. I need to send file "test.txt" from > > my sdcard to my ftp-server. And before actual file sending I create > > folder "test" on the ftp-server. > > > I have tried several code snippets that I have found from internet, > > but nothing seems to work. What I'm missing here? IS there some errors > > in code or do I need to add more permission or some special project > > settings to access FTP. > > > After getting this atom part of application working I can add more > > features, like file chooser. > > > //up.java class > > > import android.app.Activity; > > import android.os.Bundle; > > import org.apache.commons.net.ftp.FTPClient; > > import java.io.FileInputStream; > > > public class up extends Activity { > > > FileInputStream fis = null; > > > /** Called when the activity is first created. */ > > @Override > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > > FTPClient ftpClient = new FTPClient(); > > try { > > > ftpClient.connect("mydomain.com", 21); > > ftpClient.login("user", "password"); > > > ftpClient.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE); > > > ftpClient.makeDirectory("test"); > > > String filename = "/sdcard/test.txt"; > > fis = new FileInputStream(filename); > > ftpClient.storeFile(filename, fis); > > ftpClient.logout(); > > fis.close(); > > > } catch (Exception e) { > > e.printStackTrace(); > > } > > finally > > { > > try > > { > > if (ftpClient.isConnected()) > > { > > ftpClient.logout(); > > ftpClient.disconnect(); > > } > > } > > catch (Exception e) > > { > > // do nothing > > } > > } > > > } > > > } > > > //Class end > > > Also in AndroidManifest.xml I have set: > > > <uses-permission android:name="android.permission.INTERNET" /> > > > do I need to add more permissions? > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > ~ Jeremiah:9:23-24 > Android 2D MMORPG:http://solrpg.com/http://www.youtube.com/user/revoltingx -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

