I am a little unsure of how to approach this so I am open for suggestions. I have an Applet that pulls data from a web server. The user can change the data but when they press a SAVE button I need to write some data in the form of a XML file back to a folder on the server. Right now I have nothing but server space that houses my Applet. What is the best way to go about this? Thanks
I need to do this upload anonymously so doing it by FTP would probably not work. On researching some more it seems that servlets might be what im looking for. But I am still a little unsure of what is required to implement a servlet. What is required server-side to place the uploaded file in a directory and what is required client side to initiate the upload from the local computer? Thanks
Is it an actual file you want to upload? It sounds as if it may just be some XML data. If so, then no more than an HTTP POST is required (which the java.net.HttpURLConnection class can handle). On the server side you'd need a servlet container such as Tomcat (or Jetty, Resin, GlassFish, JBoss, WebLogic, WebSphere etc.).
Ok, Iv researched a little bit and have been able to set up a HTML form to submit a HTTP POST request and then a PHP script on the back end to accept it and place the file in an upload directory on my server. This works 100%. But now I need to get this functionality in my Java code. The applet I wrote will create a temporary XML file on the users computer but when the user chooses to save all changes it will upload the entire file to the server. I basically need the functionality of the HTML form that I attached in Java code. I imagine I can just use the same PHP script that I have attached as well. Could anyone start me off with some code or specific examples? Thanks
Jesse Miller wrote:Ok, Iv researched a little bit and have been able to set up a HTML form to submit a HTTP POST request and then a PHP script on the back end to accept it and place the file in an upload directory on my server. This works 100%. But now I need to get this functionality in my Java code.
In other words, you need your applet to issue a POST request with the file attached. Start by reading this tutorial; notice that the parts which cover your requirement are near the bottom of that page.
The fastest and most reliable components of any system are those that are not there. Tiny ad:
a bit of art, as a gift, the permaculture playing cards