Java Reference
In-Depth Information
POST /1/7/post.php HTTP/1.
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, ap-
plication/x-shockwave-flash, */*
Referer: http://www.httprecipes.com/1/7/post.php
Accept-Language: en-us
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: www.httprecipes.com
Content-Length: 36
Connection: Keep-Alive
Cache-Control: no-cache
search=Missouri&type=s&action=Search
As you can see from the above data, the form data is transmitted right after the HTTP
headers. Later in this chapter you will be shown how you can quickly generate this data for
posts of your own.
Multipart POST
In addition to the regular post discussed in the last section, there is also a multipart post.
Most forms you will encounter are not multipart posts. The only time you will encounter a
multipart post is when the form allows you to upload a file. You can easily tell a multipart post
by the format of the <form> tag:
<form enctype="multipart/form-data" action="uploader.php"
method="POST">
You can easily identify a multipart form by the enctype attribute of the <form> ele-
ment. If the enctype is multipart/form-data, then you are dealing with a multipart form.
A multipart POST has a much different format than a regular post. In addition to the
regular form elements, a multipart post allows files to be sent. You can see an example of a
multipart form at the following URL:
http://www.httprecipes.com/1/7/upload.php
You can also see the form in Figure 7.3.
Search WWH ::




Custom Search