多文件上传文件数组不为空的判断

今天遇上一件怪事,在做多文件上传时,判断文件数组不为空居然不管用。我是这样判断的,
@RequestMapping("filesUpload")

public void filesUpload(@RequestParam("files") MultipartFile[] files,HttpServletRequest request,HttpServletResponse response)throws Exception {
String patientId = request.getParameter("patientId");
String doctorId = request.getParameter("doctorId");
PrintWriter out=response.getWriter();
if(patientId!=null&&patientId.trim().length()>0&&doctorId!=null&&doctorId.trim().length()>0){
try {
int docId=Integer.valueOf(doctorId);
ECG ecg=new ECG();
ecg.setDoctorId(docId);
ecg.setPatientId(patientId);
System.out.println("files:"+files.length);
System.out.println("null:"+files==null);
//判断file数组不能为空并且长度大于0

if(files!=null||files.length>0){

//循环获取file数组中的文件

for(int i = 0;i MultipartFile file = files[i];
//保存文件
saveFile(file,request,ecg);
}
虽然我做了非空判断, if(files!=null||files.length>0),然后我在前端测试,没有选择上传文件 但是后台打印出来的files长度居然为2,files不空。以下是我的前端测试页面代码:

           <td>医生id:</td>
           <td><input type="text" name="doctorId" id="doctorId"></td>
         </tr>
         <tr>
          <td>用户id:</td>
          <td><input type="text" name="patientId" id="patientId"></td>
         </tr>
        <tr>
           <td>选择文件</td>
           <td><input type="file" name="files" ></td>
        </tr>
        <tr>
           <td>选择文件</td>
           <td><input type="file" name="files" ><input type="submit" value="提交"></td>
        </tr>
     </table>

劳烦知道的大神帮我看一下,具体哪天出错了,调试的时候,明明没有选择有文件,依然跑到if里边去了,找了老半天,试了其他也不奏效。

我估计是之前上传的文件,你把浏览器关闭重启一下,或者把缓存清空一下

files=>files[]