文件上传+显示
appx 2008-11-09 07:35:50 我要通过点击form中上传这个button按钮实现将图片上传到服务器文件夹里。将其路径同文字一同存入数据库,其中点击了上传button按钮后,把图片上到相应的位置,并显示在文本框中。就像QQ空间发帖那样。
<form name="addnews" action="add_news.jsp" method="post">
<table width="580">
<tr><td><table>
<tr><td bgcolor="bluegray" width="50" align="center">标题</td><td><input type="text" name="title"></td></tr>
<tr><td bgcolor="bluegray" width="50" align="center">作者</td><td><input type="text" name="author"></td></tr>
<tr><td bgcolor="bluegray" width="50" align="center">图片</td><td><input type="file" name="picture"><input type="button" name="uppicture" value="上传" onclick=<%uppic.doPost(request,response); %>></td></tr>
</table></td></tr>
<tr><td><textarea name="news_content" rows="20" cols="80"></textarea></td></tr>
<tr><td><input type="submit" name="submit" value="发布"><input type="reset" name="reset" value="重写"></td></tr>
</table>
</form>