File Upload Sample Code

Home Download Demo Contact Us
 :: About Us
 :: Services
 :: Contact Us
 :: Rad SFTP
 :: Rad Upload
 :: MMS
 :: Print Suite
 :: Card Designer
Buy Now


Applet Configuration

Parameter Passing

Change Notes

Developer FAQ

PHP Upload Configuration

These sample scripts are provided free of charge to help you get started on processing file uploads. These scripts are not a part of Rad Upload and therefore no support can be offered in their usage.

Standard Server Side Handlers

The scripts detailed below can be used on your server to accept file uploads. The url parameter of the applet should be set to point to the script once it is deployed on your server.

Basic Handler

This is a sample script that accepts the incoming files and saves them to a specified directory. Pathnames, if they are passed by the applet (or browser) are stripped out. The script does not filter by file types and silently over writes existing files. The same scripts given below, are bundled with the download as well.

download: PHP version  |  perl version  |  JSP version

Filter By File Type

Generally for reasons of security it is recommended that uploaded files are saved outside the webspace ie: In a folder that is not a subdirectory of your DocumentRoot. If for some reason you are forced to save with in the web space you should filter by file types to prevent your users uploading executable content.

This filtering is usually carried out by inspecting the files extension and not by inspecting the file's content.

download: PHP version  |  perl version

Recreate Directory Tree

With Rad Upload Plus it is possible to carry out recursive folder uploads. There will be instances where it's usefull for your web application to be able to attempt to recreate the folder structure on the client machine on your webserver. Additional parametes passed by the applet to the server side handler makes this task easier.

download: PHP  |  perl  |  JSP

Handlers that support resume

The following code samples are intended to be used when Rad Upload Plus is used in Resume mode. It allows for very large files to be transferred almost independently of server configurations. Should some interuption occur, the trasnfer can be resumed from that point without having to resend all the data.

download: PHP  |  perl  |  Java Servlet

Applet Containing Web Page

The download bundle contains three files namely applet.html, applet-js.html and applet.php they can all be used as the applet containing web page. The applet-js.html and applet.php files are similar in functionality - they both attempt to instruct the browser to install the Java plug in if it is not available. applet.html on the other hand uses the <applet> tag and does not cause the browser to attempt plug in installation. It is recommended that you use applet-js.html. You can cut and paste the code into your own web page to embed the applet.

These files from the download are reproduced here along with other examples in perl and JSP

Plain Vanilla HTML

applet.html is the plain vanilla html version already mentioned above. This is perhaps the easiest to customize since the plug in detection code is not included. Once you have made your changes you can invoke the htmlconvertor tool (a part of the J2SDK) and generate a javascript that does attempt to detect and install the java plug in.


applet-js.html is derived from the one that is generated by htmlconvertor when applet.html is given as the input.

This script is similar in functionality to applet-js.html with the difference being that this file is a PHP script. You will find that this also demonstrates how the applet could be placed in a directory protected by basic HTTP authentication (also known as .htaccess authentication).
The JSP version is similar to the applet.php or applet-js.html but it is intended to be used on a servlet container.

Special care needs to be taken when using this perl version of the applet containing web page. On many webservers any file that is placed on the cgi-bin folder will be executed as a result the jar file of the applet cannot be placed in the same folder as applet.cgi. Therefor you will either need to use an absolute path when specifying the jar file location or move the perl script out of the cgi folder.

Contributed Samples

You will find more scripts (notably for ASP.NET and ColdFusion), in the user contributed samples page. Contact us if you would like to share your script with user users.

Note: A .txt suffix has been added to all the sample scripts above. This is ensure that the scripts are opened in your browser rather than being executed at the server. Please remove this suffix when you upload these files to your own web server.


  Quick Navigator }  
Learn More,   Online Demo,   Q & A,   Docs,  
Download,   Features & Pricing,   Source Code



Site Map  |  About us  |  Services  |  Contact Us  |  Members

Copyright 2009 Rad Inks (Private) Limited. All Rights Reserved.

Privacy Policy   |  Terms of Use