JSP Tutorials - Herong's Tutorial Examples - Version 4.03, by Dr. Herong Yang
Test 2 - POST Method - Successful
This section provides a tutorial example of testing file upload with the HTTP POST method and multipart/form-data encryption type. The test worked. All input values, including uploaded files, are dumped back on the browser.
The previous test of using the HTTP GET method was not very interesting. In the next test, I changed settings on the UploadInit.html page: Submit method = Post and Encryption type = multipart/form-data.
File Upload Test Settings: File upload handler: [UploadDump.jspx] Submit method: [post] Encryption type: [multipart/form-data ] Submit
Then I selected the same files on the UploadForm.jsp page, and I got the following dump:
-----------------------------7d53495100260 Content-Disposition: form-data; name="email" herong_yang@yahoo.com -----------------------------7d53495100260 Content-Disposition: form-data; name="comment" I am uploading two files: hello.txt dot.gif -----------------------------7d53495100260 Content-Disposition: form-data; name="file1"; filename="C:\hello.txt" Content-Type: text/plain Hello world! -----------------------------7d53495100260 Content-Disposition: form-data; name="file2"; filename="C:\dot.gif" Content-Type: image/gif GIF89a 333 !? , D ; -----------------------------7d53495100260 Content-Disposition: form-data; name="submit" Submit -----------------------------7d53495100260--
The output looks very interesting now:
Last update: 2012.
Table of Contents
JSP (JavaServer Pages) Overview
Tomcat 7 Installation on Windows Systems
Syntax of JSP Pages and JSP Documents
JavaBean Objects and "useBean" Action Elements
Managing HTTP Response Header Lines
Non-ASCII Characters Support in JSP Pages
Overview of JSTL (JSP Standard Tag Libraries)
Multiple Tags Working Together
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 2 - POST Method - Successful
Code 4 - Save File - UploadSave.jspx