FTP Applet Uploader
I’m sure most web programmers have come across difficulty uploading large files through HTTP forms.
Firstly, there is usually a myriad of different configuration options that need to manipulated and tweaked to actually allow large files to be submitted without the server killing the connection prematurely. Then there is the fact there is no actual user feedback to indicate what is going on. The page just remains static for long periods of time without any indication of the progress of the upload, so users understandably get frustrated and start clicking “refresh”, which (of course) just compounds the problem.
So, what’s the solution? Well, Macromedia (Adobe) has put its two cents in with the Flash 8 File Uploading functionality, but this is limited to files smaller than 100MB. Thankfully there is another web technology which has been used quite extensively throughout the internet that can perform this sort of stuff: Java applets.
Using java we can create an FTP connection to the server and upload a file to a drop area for movement by PHP (or your language of choice). Of course there are a few security hoops to jump through; you can only upload to the server that you loaded the applet from and the applet needs to be signed with a digital certificate before it can access files from your computer. However once these things are out of the way, we are good to go!
And here is the finished product. You can change the colours used by simply passing different parameters to the applet so that it fits in correctly with your website. The bundle also includes a detector applet that will ensure the user has the required Java Virtual Machine before showing the uploader to the user.


While this doesn’t fix the issue, it should provide an effective work-around for those wanting a little bit more than what the good ole file input type provides.


December 3rd, 2006 at 9:40 am
Hi Richard,
I’m attempting to create a modified version of this script for uploading large files to my site ( > 100Mb), as its just the sort of simple use of java ftp I’m after. I tested locally with a short connect (to a remote ftp) and create directory routine, recompiling everything using your compilation script once I’d finished.
While everything loads correctly, and my connection and directory creation elements seem to work fine, the script fails when actually attempting to transfer the file. The status bar just reads 8Kb and sits at 0%.
Any ideas?
December 10th, 2006 at 2:21 pm
First of all, sorry for the delay in my reply, it has been a crazy week.
With your problem, ensure your uploadedFileName parameter is an absolute path to the file you want the data to be saved to and that you accepted the security certificate.
There could be a few things causing this issue (unfortunately), including firewall stuff. You may be able to check the applet console for more information on what is going on.
To do this load up the applet without attempting to upload the file. Then right click on the java icon in your taskbar and click “Open Console”. Then try uploading the file and see what messages appear in the console.
Feel free to hit me back here with any error messages that popup and I’ll try and work through them with you.
January 7th, 2010 at 6:16 pm
HI Richard,
I know its been a long time since you published this entry, and a while since your last post. However I am hoping you can help me out a little if you get this. I am using this nifty little applet to bypass by hosts upload limit.
It seems at a certain point in the middle of uploading a file the thread quits with a java.lang.NullPointerException
on ftpOut.write(buffer, 0, bytesRead);
I cant for the life of me understand why it would happen. I get 8 KB’s into the upload then bang, right on 8 i get this exception everything time.