jspSmartUpload上传文件,主要体现对上传失败的文件进行提示,api没有找到这方面的实现。于是剑走偏锋,对Exception的信息进行了contains操作,从而判断是哪种上传失败类型。不知道这种方式是否合理,请大家指正……
一、将jspSmartUpload.jar导入到项目的lib中。
二、上传页面
上传页面简单实现,1个from,2个文本域,1个上传按钮。注意form需要添加属性enctype="multipart/form-data"
<form name="queryform" id="queryform" method="post" enctype="multipart/form-data">
<table>
<tr class="formtext">
<td width="82" height="24" align="right">文件 | </td>
<td width="150" align="left" style="padding-left:8px">
<input type="file" name="upFile" id="upFile"/>
</td>
<td width="150" align="right"><nobr>文件2 | </nobr></td>
<td width="150">
<input type="file" name="upFile2" id="upFile2"/>
</td>
<span style="white-space:pre"> <td width="150" align="right"><nobr>文件名称 | </nobr></td>
<span style="white-space:pre"> </span><td width="150">
<span style="white-space:pre"