Test 1 - GET Method - Failed

This section provides a tutorial example of testing file upload with the HTTP GET method. The test failed, because file upload only works with the POST method, not the GET method.

Before looking the Part 4, UploadSave.jspx, let's test the first 3 parts now on my Tomcat 7 server by copying all 3 pages to \local\apache-tomcat-7.0.32\webapps\ROOT.

Then I run IE (Internet Explorer) 8.0 with http://localhost:8080/UploadInit.html. I got the form for changing file upload options:

File Upload Test Settings:

Submit method: [get ]
Encryption type: [application/x-www-form-urlencoded]
Submit


Without changing any values in the form, I clicked the submit button. I got the file upload form:

File Upload Form:

[   hello.txt                  ]
[   dot.gif                    ]
File 1: [                              ] Browse...
File 2: [                    ] Browse...
Submit


Observe that:

• IE displays a "Browse..." button as part of a FILE type input field.
• IE ignores the "value=hello.txt" attribute in a FILE type input field. I was expecting "helle.txt" to show up in the input field as the default value.

To continue the test, I used the "Browse..." button, and selected two local files, C:\hello.txt and C:\dot.gif, into "File 1" and "File 2" input fields. Then clicked the Submit button, I got a blank page.

Why? Because the submit method was set to "get". As you remember, the "get" method requires the browser to submit all input fields in the HTTP request header. In fact, if you look at the address field of the browser, you would see the URL encoded input fields appended at the end of the URL:

http://localhost:8080/jsp/UploadDump.jsp?email=herong_yang@yahoo.com&