Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

upload a file at server

 
rajesh kumar jhaver
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to upload a file on to server at particular destination(c:\temp)without user interaction(it has to be done like task).

------------------
 
Toseef Alam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajesh,
Did you solve the your File upload to server without user intraction problem. Please let me know about it, I am also want to do the samething.
Thanks,
Toseef
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you could give us a bit more information about the nature of your application, it would help determine what the solution may be. Are you using an applet, servlets, web pages, etc?
 
Dan Nissen
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also looking at doing this. Basically I need to have an applet create up the contents of an CSV file and then upload it to a server. Is that possible using an applet or do I need to use something different?
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dan
I see two possible approaches here,
1. Use "Http tunneling" via using URLConnection.
- From your applet establish a URLConnection to one of the servlet, which you will have to write, and then just write the file as String or FileOutputStream or FileWriter or something.
- Now, one can raise some issues when the file huge etc...but I am just blurring out from top of my mind
- The servlet I mentioned here would accept the file and also the parameter that specifies the location where we need to upload the file and write the file subsequently to the specified location.
2. Use some FTP client program to communicate and transfer the file.
- This FTP client can be a java ftp client, which most probably you can obtain via googling things.
- Though for this you will need to have FTP server running on a machine where you want to transfer the data
3. Open a socket to the server user pure Client/Server thing to transfer the file.
Here, the applet would have to follow a restriction that says "applet can only open connections to the server from where it came"...
Hope this is going in some positive direction...
Regards
Maulin
 
Dan Nissen
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that. Since the unix server is running a ftp server aswell I think I will go with option 2.
Now I know this is getting a little off topic, but once the file is on the server I need to run an application from that unix server using telnet. Is there any way to do this also through the applet?
Thanks again.
-Dan
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dan
Can you please explain in more details? I don't understand why you want to do telnet to run the application? Instead once the ftp is done, you can invoke the application just by using Runtime.exec() from that server right? (I don't mean from the applet you use Runtime.exec() here but in the server code which will handle the ftp can invoke it once ftp is done).
Regards
Maulin
 
Dennis Meyer
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you need an FTP API you can look at the oroinc.net.* packages avaiable at jakarta. So you don't need to implement the whole FTP stuff. Also many other protocols are supported.
 
Dan Nissen
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, so basically here is what is happening.
My applet is used to create a .csv file. That .csv file is then ftp'd to the other server. Then once the file is on that other server I need to send a command to that server (via telnet) to have that file processed.
Thats the aim in a nutshell.
 
Dennis Meyer
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just have a look at the ORO NetComponents.
http://www.savarese.org/oro/
Now it's a Jakarta Project available under
http://jakarta.apache.org/commons/net/
Look at the API docs. This package has all functionality you are looking for (FTP / Telnet) and even many more if you need to upgrade your program.
A solution only with sun classes is possible but not really recommended as you have to code on basic network layers.
If the package don't fit for your purpose, there are also other FTP API's available. Just google for them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic