| Processing the File Upload on the Server |
Because AppletFile supports the RFC 1867 standard, any server-side scripting tool that is compliant with RFC 1867 can be used to process the file upload requests. As examples of the different ways in which the server-side processing can be accomplished, two different versions of each sample are provided with AppletFile. One based on ActiveFile for Microsoft Active Server Pages (*.asp files) and one based on Allaire Cold Fusion (*.cfm files).
Regardless of the the scripting tool, the files uploaded by AppletFile will be identified in the RFC 1867 form data stream with the same form element names. The naming convention for the file elements is FILEn where n is a number starting at 1 (FILE1, FILE2, FILE3, etc).
Using ActiveFile, you can upload and display the name of the first file using the following script:
Set Post = Server.CreateObject("ActiveFile.Post")
Post.Upload "C:\Temp"
Response.Write "<H1>" & Post.FormInputs("FILE1").File.Name & "</H1>"
With Cold Fusion, the same thing could be accomplished with the following script:
<CFFILE ACTION="UPLOAD" FILEFIELD="FILE1" DESTINATION="C:\Temp"> <CFOUTPUT> <H1>#File.ServerFile#</H1> </CFOUTPUT>
In addition to the file elements, a single text element named FILE_DIR is automatically inserted into the form data stream by AppletFile. This element contains the last directory used to select a file. You can save the user from having to navigate to this directory again by using this element to set the directory parameter the next time they start the Upload Applet.
For more information on processing file uploads on the server, refer to the documentation that came with your scripting tool.