Code 1 - Display Options - UploadInit.html

This section provides a tutorial example of a static HTML page, UploadInit.html, presenting different upload options for the user to try different ways to upload a file

Now we know how to write a HTML page for uploading files. What's next is to know how to handle the uploaded files embedded in the HTTP request on the Web server side.

Unfortunately, normal Web servers do not offer any support to handle the uploaded files. JSP also does not offer any support to handle the uploaded files automatically. We need additional special programs on the Web server side to do this job.

Of course, there are a lot existing programs available on the Internet that can be installed on the Web server to handle uploaded files. But writing such a program yourself is also not very hard. I am planning to write following JSP pages to create a file upload test application:

As Part 1 of the file upload test, here is my UploadInit.html page, which will let you change the upload settings to see how your browser is submitting different types of input fields with different encryption types:

<?xml version="1.0"?>
<!-- UploadInit.html
 - Copyright (c) 2012,, All Rights Reserved.
<b>File Upload Test Settings:</b><br/>
<form action="UploadForm.jspx" method="get">
File upload handler:<select name="action">
Submit method:<select name="method">
Encryption type:<select name="enctype">
<option value="x-www-form-urlencoded">
<option value="form-data">multipart/form-data</option>
<input type="submit" name="submit" value="Submit"><br/>

Last update: 2012.

Table of Contents

 About This Book

 JSP (JavaServer Pages) Overview

 Tomcat 7 Installation on Windows Systems

 JSP Scripting Elements

 Java Servlet Introduction

 JSP Implicit Objects

 Syntax of JSP Pages and JSP Documents

 JSP Application Session

 Managing Cookies in JSP Pages

 JavaBean Objects and "useBean" Action Elements

 Managing HTTP Response Header Lines

 Non-ASCII Characters Support in JSP Pages

 Performance of JSP Pages

 EL (Expression Language)

 Overview of JSTL (JSP Standard Tag Libraries)

 JSTL Core Library

 JSP Custom Tags

 JSP Java Tag Interface

 Custom Tag Attributes

 Multiple Tags Working Together

File Upload Test Application

 RFC 1867 - Form-based File Upload in HTML

Code 1 - Display Options - UploadInit.html

 Code 2 - Display Form - UploadForm.jspx

 Code 3 - Dump File - UploadDump.jspx

 Test 1 - GET Method - Failed

 Test 2 - POST Method - Successful

 Code 4 - Save File - UploadSave.jspx

 Test 3 - Save File - Successful

 Code Review - UploadSave.jspx

 Outdated Tutorials


 PDF Printing Version