我的HTML代码是:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="UploadServlet" method="post" enctype="multipart/form-data">
<input type="file" name="file" />
<p>After submitting such a form the binary multipart form data is available in the HttpServletRequest#getInputStream()</p>
<input type="submit" />
</form>
</body>
</html>
之后我想把这个文件显示为另一个页面上的帖子,所以也帮助我。