JspSmart之upload组件源码及使用
JspSmart之upload组件源码主要包括了5个java文件File.java
import java.io.ByteArrayInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
// Referenced classes of package com.jspsmart.upload:
// SmartUploadException, SmartUpload
public class File
{
private SmartUpload m_parent;
private int m_startData;
private int m_endData;
private int m_size;
private String m_fieldname;
private String m_filename;
private String m_fileExt;
private String m_filePathName;
private String m_contentType;
private String m_contentDisp;
private String m_typeMime;
private String m_subTypeMime;
private String m_contentString;
private boolean m_isMissing;
public static final int SAVEAS_AUTO = 0;
public static final int SAVEAS_VIRTUAL = 1;
public static final int SAVEAS_PHYSICAL = 2;
File()
{
m_startData = 0;
m_endData = 0;
m_size = 0;
m_fieldname = new String();
m_filename = new String();
m_fileExt = new String();
m_filePathName = new String();
m_contentType = new String();
m_contentDisp = new String();
m_typeMime = new String();
m_subTypeMime = new String();
m_contentString = new String();
m_isMissing = true;
}
public void saveAs(String s)
throws IOException, SmartUploadException
{
saveAs(s, 0);
}
public void saveAs(String s, int i)
throws IOException, SmartUploadException
{
String s1 = new String();
s1 = m_parent.getPhysicalPath(s, i);
if(s1 == null)
throw new IllegalArgumentException("There is no specified destination file (1140).");
try
{
java.io.File file = new java.io.File(s1);
FileOutputStream fileoutputstream = new FileOutputStream(file);
fileoutputstream.write(m_parent.m_binArray, m_startData, m_size);
补充:Jsp教程,Jsp/Servlet开发工具