Upload a file to a serverTag(s): Networking


To upload a file to a server you need something on the server side to accept the file, you can't do it with client-side code only. A simple way to use the HTML tag in a FORM

<FORM METHOD=POST ENCTYPE="multipart/form-data" ACTION="../myuploadscript">
File to upload: <INPUT TYPE=FILE NAME="upfile"><
<INPUT TYPE=SUBMIT VALUE="Submit">
</FORM>

which looks like

File to upload:

The associated FORM target is a script on the server side that can handle HTTP file upload. Typically in Java, it's a servlet.

The 2 most popular Java packages (server-side) to handle file upload are :

  • Jakarta Commons File Upload
  • O'reilly MultipartRequest (com.oreilly.servlet)

    On the client side, a java application can use Jakarta Commons HTTP client to initiate a file upload.

    Postlet is a Java applet used to enable websites to allow their users to send multiple files to a webserver with a few simple clicks. Postlet is useable with any server side scripting language that is capable of handling file uploads.


    blog comments powered by Disqus