日期:2014-05-17 浏览次数:20826 次
<html>
<head>
<title>Upload</title>
</head>
<body>
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="45" align="center" valign="middle">
<form action="index.jsp" method="post"
enctype="multipart/form-data" name="form1">
<input type="file" name="file">
<input type="submit" name="Submit" value="Upload">
</form>
</td>
</tr>
</table>
</body>
</html>
------解决方案--------------------
String filePath = request.getSession().getServletContext().getRealPath("文件夹名");
filePath += "/文件名";
File file = new File(filePath);
FileOutputStream fos = new FileOutputStream(imgPath);
fos.write(formFile.getFileData());//struts上传FormFile
fos.flush();
fos.close();
------解决方案--------------------
String filePath = request.getSession().getServletContext().getRealPath("文件夹名");
filePath += "/文件名";
File file = new File(filePath);
FileOutputStream fos = new FileOutputStream(imgPath);
fos.write(formFile.getFileData());//struts上传FormFile
fos.flush();
fos.close();
这个很简单啊
------解决方案--------------------
恩这个问题 也困扰着我呢
帮忙顶着~~
确实 如果直接从数据库拿出来 他的现实就是
<img width="80" height="60" src="F:\tomcat6018\webapps\hahafanProject\img\shangchuan\restaurant\1017.jpg"
alt="于记河问胖子驴肉馆" />