title: File Upload with Java (with progress bar)
body: <p>I'm <em>extremely new</em> to Java, and have mostly just been teaching myself as I go, so I've started building an applet. I'd like to make one that can select a file from the local disk and upload it as a multipart/form-data POST request but <strong>with a progress bar</strong>. Obviously the user has to grant permission to the Java applet to access the hard drive. Now I've already got the first part working: the user can select a file using a <code>JFileChooser</code> object, which conveniently returns a <code>File</code> object. But I'm wondering what comes next. I know that <code>File.length()</code> will give me the total size in bytes of the file, but how do I send the selected <code>File</code> to the web, and how do I monitor how many bytes have been sent? Thanks in advance.</p>