1

I'm trying to upload a file to an FTP using apache commons ftp. I am using a code that I have seen on several websites, including stackoverflow

Android FTP Library

The problem is that in the line:

Buffin = new BufferedInputStream (new FileInputStream (file));

I can not put any paths in "file", eclipse does not validate any values ​​or path-

What would have to indicate in "new FileInputStream"?

I do not know I'm doing wrong.

Thank you very much and best regards

Community
  • 1
  • 1
user986689
  • 111
  • 10

3 Answers3

2

You need a File object to pass it to the FileInputStream.

Buffin = new BufferedInputStream(new FileInputStream(new File("/path/to/file"));

And you can't Upload file to FTP because FTP is not a place, it is a protocol.

WarrenFaith
  • 57,492
  • 25
  • 134
  • 150
1

Create a File object with the path and pass it in.

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123
1

You can do this: Buffin = new BufferedInputStream (new FileInputStream (<path to your file>));

Details here: FileInputStream

ACC
  • 2,488
  • 6
  • 35
  • 61