java通过commons-fileupload实现多张图片的上传(jsp页面)
<div id="middle"> <div id="form"> <form action="ProductInfoServlet?tag=add" method="post" enctype="multipart/form-data" > <h2>三只松鼠--新增</h2> <table align="center"> <tr> <td width="90px" class="td">类型:</td> <td width="200px" > <select name="typename"> <option>---请选择--</option> <c:forEach items="${tlist }" var="type" varStatus="status"> <option value="${type.typeId}">${type.typeName }</option> </c:forEach> </select> </td> </tr> <tr> <td width="90px" class="td">品牌:</td> <td width="200px" > <select name="brand"> <option>---请选择--</option> <option >三只松鼠</option> </select> </td> </tr> <tr> <td width="90px" class="td">名称:</td> <td> <input type="text" name="produceName" id="name"> </td> </tr> <tr> <td width="90px" class="td">详情介绍:</td> <td> <textarea cols="20px" rows="1px" name="details"></textarea> </td> </tr> <tr> <td width="90px" class="td">价格:</td> <td> <input type="text" name="price" id="price"> </td> </tr> <tr> <td width="90px" class="td">库存:</td> <td> <input type="text" name="stock" id="price"> </td> </tr> <tr> <td width="90px" class="td">大图:</td> <td> <input type="file" name="bigfile" id="price"> </td> </tr> <tr> <td width="90px" class="td">小图1:</td> <td> <input type="file" name="smallfile1" id="price"> </td> </tr> <tr> <td width="90px" class="td">小图2:</td> <td> <input type="file" name="smallfile2" id="price"> </td> </tr> <tr> <td width="90px" class="td">小图3:</td> <td> <input type="file" name="smallfile3" id="price"> </td> </tr> <tr> <td colspan="2"><input type="submit" value="新增"> <input type="button" value="取消"></td> </tr> </table> </form> </div> </div>
css样式:
<style type="text/css"> #middle { width:100%; height:600px; border:1px #000000; background-image:url(media/image/bg/2.jpg); color:#FFF; padding-top:110px; } h2{ text-align:center; padding-top:10px; } #form { text-align:center; border: #999 1px solid; height:560px; width:600px; margin:0px auto; background-color:#ACACAC; opacity:0.02px; box-shadow:0px 0px 100px; } #form .td { font-size:18px; font-weight:bolder; } #form td { padding-top:10px; } </style>
温馨提示:此方法得用到两个jar包,需要的请前往这里下载!!!
分类:
实用技巧
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架