user986689
user986689

Reputation: 111

Upload file to FTP

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

Upvotes: 1

Views: 1437

Answers (3)

ACC
ACC

Reputation: 2570

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

Details here: FileInputStream

Upvotes: 1

WarrenFaith
WarrenFaith

Reputation: 57702

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.

Upvotes: 2

Manfred Moser
Manfred Moser

Reputation: 29912

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

Upvotes: 1

Related Questions