JspSmart upload component source code and usage

Source: Internet
Author: User
JspSmart upload component source code mainly includes five java files
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 );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.