Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FTP

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to write a program in java that can do a FTP file transfer
 
Todd M Bush
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure is. I'm working on one right now. There are a few examples out there as well.
 
Pawel Veselov
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And you can check out this page:
http://www.alphaworks.ibm.com/ab.nsf/bean/FTP+with+Source

------------------
With best of best regards, Pawel S. Veselov ( aka Black Angel )
 
Savithri Devaraj
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could some post some examples for ftping files over to an IP address?
Iam thinking of using the URL class with protocol=ftp. Is this the way to do it?
Thanks,
Savithri
 
teiag
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to run unix shell script through Java?
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes there is. You have to understand a little about the URL it is expecting.
ftp://username :password@ftp.server.com/full/path/to/file/filename;type=x
type for getInputStream can be 'd' for directory listing, 'a' for Ascii down load and 'i' for Binary download.
type for getOuputStream can be 'a' for ascii upload and 'i' for binary upload.
So, to put a text file you can use code similar to the following


------------------
Hope This Helps
Carl Trusiak, SCJP2
[This message has been edited by Carl Trusiak (edited June 23, 2001).]
[This message has been edited by Carl Trusiak (edited June 23, 2001).]
 
Savithri Devaraj
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[/b]
</BLOCKQUOTE>
Carl,
I appreciate your help here, but what is "/full/path/to/file/filename"?? Did you mean "filedirectory/filename" ??
I am pretty much doing the same thing, but I get an exception on the getOutputStream() statement. UnknownServiceException" - This service is not supported by the protocol.
Only difference is - I am not setting type='a'. I am going to try that next.
Any ideas??
Savithri

[This message has been edited by Savithri Devaraj (edited June 26, 2001).]
 
Savithri Devaraj
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Carl Trusiak:
[B]Yes there is. You have to understand a little about the URL it is expecting.
ftp://username assword@ftp.server.com/full/path/to/file/filename;type=x
type for getInputStream can be 'd' for directory listing, 'a' for Ascii down load and 'i' for Binary download.
type for getOuputStream can be 'a' for ascii upload and 'i' for binary upload.
So, to put a text file you can use code similar to the following

[/B]

Carl,
Where can I find more information to read up on this?
Savithri
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your name 'teiag' does not comply with the JavaRanch naming policy. Please spare a moment and re-register with a name that meets the requirements.
Thanks!
 
Pratik Khetia
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pawel Veselov:
And you can check out this page:
http://www.alphaworks.ibm.com/ab.nsf/bean/FTP+with+Source


 
peter rapier
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ibm alphaworks ftp beans moved here:
http://oss.software.ibm.com/developerworks/opensource/ftp/index.html
 
peter rapier
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ibm alphaworks ftp beans moved here:
http://oss.software.ibm.com/developerworks/opensource/ftp/index.html
 
khurram mirza
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've to upload some file form client side to server side.besides writing the java code for file transfer as suggested by some of you,Whether i've to run ftp service at server side where web server is already running or not.
khurram mirza
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic