给你一段代码参考吧,有问题再说,你自己再修改一下save里面函数体,来实现数量 public int save(String s,int i) throws ServletException,IOException,SmartUploadException
{
int j = 0;
if(s == null)
{
s = m_application.getRealPath("/");
//System.out.println("s == null,m_application.getRealPath:" + s);
}
if(s.indexOf("/") != -1)
{
if(s.charAt(s.length() - 1) != '/')
{
s = s + "/";
//System.out.println("m_application.getRealPath::" + s);
}
}
else
{
if(s.charAt(s.length() - 1) != '\\')
{
s = s + "\\";
//System.out.println("m_application.getRealPath" + s);
}
}
//System.out.println("m_application.getRealPath:::" + s);
FileNames = new String[m_files.getCount()];
for(int k = 0;k < m_files.getCount();k++)
{
if(!m_files.getFile(k).isMissing())
{
//System.out.println("s + m_files.getFile(k).getFileName():" + s + m_files.getFile(k).getFileName());
m_files.getFile(k).saveAs(s + m_files.getFile(k).getFileName(),i);
FileNames[j] = s + m_files.getFile(k).getFileName();
j++;
}
} return j;
} //Add
private String[] FileNames;
public String[] getFileNames()
{
//Method may expose internal representation by returning array
//Returning an array value stored in one of the object's fields exposes the internal representation of the object.? For classes shared by other untrusted classes, this could potentially be a security issue.? Returning a new copy of the array is better approach in many situations.
String[] vFileNames = new String[FileNames.length];
System.arraycopy(FileNames,0,vFileNames,0,FileNames.length);
return vFileNames;
}
{
int j = 0;
if(s == null)
{
s = m_application.getRealPath("/");
//System.out.println("s == null,m_application.getRealPath:" + s);
}
if(s.indexOf("/") != -1)
{
if(s.charAt(s.length() - 1) != '/')
{
s = s + "/";
//System.out.println("m_application.getRealPath::" + s);
}
}
else
{
if(s.charAt(s.length() - 1) != '\\')
{
s = s + "\\";
//System.out.println("m_application.getRealPath" + s);
}
}
//System.out.println("m_application.getRealPath:::" + s);
FileNames = new String[m_files.getCount()];
for(int k = 0;k < m_files.getCount();k++)
{
if(!m_files.getFile(k).isMissing())
{
//System.out.println("s + m_files.getFile(k).getFileName():" + s + m_files.getFile(k).getFileName());
m_files.getFile(k).saveAs(s + m_files.getFile(k).getFileName(),i);
FileNames[j] = s + m_files.getFile(k).getFileName();
j++;
}
} return j;
} //Add
private String[] FileNames;
public String[] getFileNames()
{
//Method may expose internal representation by returning array
//Returning an array value stored in one of the object's fields exposes the internal representation of the object.? For classes shared by other untrusted classes, this could potentially be a security issue.? Returning a new copy of the array is better approach in many situations.
String[] vFileNames = new String[FileNames.length];
System.arraycopy(FileNames,0,vFileNames,0,FileNames.length);
return vFileNames;
}
解决方案 »
- hibernate死锁问题
- 把xml节点下的数据整体读出
- 请教关于HttpSessionListener和HttpSessionBindingListener的区别???????
- 为什么操作 Excel 用的 POI 类,JSP 打死也不肯编译,而 Java Application 却能正常运行?
- 在VISTA系统下
- weblogic8.1是否支持jsf
- 100分!!大家帮我想想我这个网站该如何推广http://www.31qq.com
- 高分请教两个问题
- 在我编写servlet中要读取一个文件的内容为什么写相对路径就包错.
- 怎样获得post方法传来的值?
- 求关于服务器集成的资料
- 急急急,大家看看我的问题
if(!m_files.getFile(k).isMissing())
{
//数量++,然后,做个get...