【发布时间】:2012-01-27 11:12:23
【问题描述】:
我已经上传了一个使用 JSP 的 mp3 文件。有没有办法以秒为单位查找上传的 mp3 文件的时长?
下面是部分代码:
pos = file.indexOf("filename=\"");
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
int boundaryLocation = file.indexOf(boundary, pos) - 4;
int startPos = ((file.substring(0, pos)).getBytes()).length;
int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
System.out.println("Content Type:"+contentType);
System.out.println("PATAH:"+saveFile);
System.out.println("Start :"+startPos);
System.out.println("endPos :"+endPos);
System.out.println("contentLength"+formDataLength);//Size of the file in Bytes
【问题讨论】: