-2

I'm a newbie on java and I have a project for my class. I need to upload or download ( need both ) a .txt file when a button is pressed. The file should be uploaded and downloaded online. I can do this with anything that help me do this , it just need to work. I don't have any knowledge about ftp's etc. What I'm supposed to study?

pksaha
  • 59
  • 6
Ferit Özcan
  • 31
  • 1
  • 10
  • first we need to know what is the protocol running on the backend: ftp, http, etc.? – ashiaka Apr 02 '15 at 13:54
  • This is a very broad question – probably too broad for the Q&A format on this site. Your question may not even have anything to do with Java. But I'll try to help answer it anyway by asking a few of my own. Are you making a website? Are you running the server yourself, or is it already online somewhere else and you're just making one page? – leekaiinthesky Apr 02 '15 at 13:55
  • Nothing is important . I can do it anyway , i must provide that any people open my program download file or upload file ( it will keep stock information) .jar application – Ferit Özcan Apr 02 '15 at 14:55
  • My project is a application program that keeps track of stock information of a salesman. There are login configuration ,both for sellers and custumers. When custumers login, program will download .txt file that contains product information. When sellers login,they will be able to add new products and update product list ( uploading txt again) i dont know how or where this txt will be uploaded . – Ferit Özcan Apr 02 '15 at 15:01

2 Answers2

0

Have a look at Java Servlets if no frameworks in use. Here is a simple example http://www.codejava.net/java-ee/servlet/multipartconfig-annotation-examples You need to have a basic Java Servlets understandings for this.

Tanzwud
  • 51
  • 1
  • 4
0

Your question is pretty vague but here some steps/ideas that could help you in your homework :

  • You wants to download a file you could maybe seek here : (it's assuming that you were given some GET url by your teacher) Get method.
  • -After having 'getted' the data you could write them in a file in a specific localisation (hard coded in a final variable or asked or given in params depending on your level of skill).
  • -You wants to upload a file, using the same classes as in the link for the GET method you could use a POST method with the data to upload.

Sorry it's pretty vague but i hope it at least helped you.

Community
  • 1
  • 1
damus4
  • 148
  • 2
  • 7
  • I Think this is not related.My project is a application program that keeps track of stock information of a salesman. There are login configuration ,both for sellers and custumers. When custumers login, program will download .txt file that contains product information. When sellers login,they will be able to add new products and update product list ( uploading txt again) i dont know how or where this txt will be uploaded . – Ferit Özcan Apr 02 '15 at 15:01