com.jspsmart.upload
Class File

java.lang.Object
  |
  +--com.jspsmart.upload.File

public class File
extends java.lang.Object

An abstract representation of an uploaded file. This is a dependant object wich can't be directly instantiate.


Field Summary
static int SAVEAS_AUTO
           
static int SAVEAS_PHYSICAL
           
static int SAVEAS_VIRTUAL
           
 
Method Summary
 void fileToField(java.sql.ResultSet rs, java.lang.String columnName)
          Save the file in a field of a database.
 byte getBinaryData(int index)
          Returns the byte corresponding to the table index containing the transmitted data.
 java.lang.String getContentDisp()
          Returns the content disposition.
 java.lang.String getContentString()
          Returns the full content.
 java.lang.String getContentType()
          Returns the content type.
 java.lang.String getFieldName()
          Returns the field's name of the HTML form.
 java.lang.String getFileExt()
          Returns the file's extension.
 java.lang.String getFileName()
          Returns the file's name.
 java.lang.String getFilePathName()
          Returns the full path of the file.
 int getSize()
          Returns the file's size.
 java.lang.String getSubTypeMIME()
          Returns the sub type mime.
 java.lang.String getTypeMIME()
          Returns the MIME Type.
 boolean isMissing()
          Test if a file is present.
 void saveAs(java.lang.String destFilePathName)
          Save the file to the specified destination.
 void saveAs(java.lang.String destFilePathName, int optionSaveAs)
          Save the file to the specified destination.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAVEAS_AUTO

public static final int SAVEAS_AUTO

SAVEAS_VIRTUAL

public static final int SAVEAS_VIRTUAL

SAVEAS_PHYSICAL

public static final int SAVEAS_PHYSICAL
Method Detail

saveAs

public void saveAs(java.lang.String destFilePathName)
            throws java.io.IOException,
                   SmartUploadException
Save the file to the specified destination.
Parameters:
destFilePathName - the destination file name
Throws:
java.io.IOException -  
SmartUploadException -  

saveAs

public void saveAs(java.lang.String destFilePathName,
                   int optionSaveAs)
            throws java.io.IOException,
                   SmartUploadException
Save the file to the specified destination.
Parameters:
destFilePathName - The destination file name.
optionSaveAs - 0 : The method save in a virtual if it exists else consider the path as a physical if the porperty denyPhysicalPath is false. 1 : The method save the file only if the path is a virtual path. 2 : The method save the file only if the path is a physical path.
Throws:
java.io.IOException -  
SmartUploadException -  

fileToField

public void fileToField(java.sql.ResultSet rs,
                        java.lang.String columnName)
                 throws javax.servlet.ServletException,
                        java.io.IOException,
                        SmartUploadException,
                        java.sql.SQLException
Save the file in a field of a database.
Parameters:
rs - the resulset to update
columnName - the destination column

isMissing

public boolean isMissing()
Test if a file is present.
Returns:
boolean true if the file is missing

getFieldName

public java.lang.String getFieldName()
Returns the field's name of the HTML form.
Returns:
String the field name.

getFileName

public java.lang.String getFileName()
Returns the file's name.
Returns:
String the file name.

getFilePathName

public java.lang.String getFilePathName()
Returns the full path of the file.
Returns:
String the full file path name.

getFileExt

public java.lang.String getFileExt()
Returns the file's extension.
Returns:
String the extension of the file.

getContentType

public java.lang.String getContentType()
Returns the content type.
Returns:
String the content type of the file.

getContentDisp

public java.lang.String getContentDisp()
Returns the content disposition.
Returns:
String the content disposition.

getContentString

public java.lang.String getContentString()
Returns the full content.
Returns:
String the content.

getTypeMIME

public java.lang.String getTypeMIME()
                             throws java.io.IOException
Returns the MIME Type.
Returns:
String the MIME Type.

getSubTypeMIME

public java.lang.String getSubTypeMIME()
Returns the sub type mime.
Returns:
String the sub MIME Type.

getSize

public int getSize()
Returns the file's size.
Returns:
int the size of the file.

getBinaryData

public byte getBinaryData(int index)
Returns the byte corresponding to the table index containing the transmitted data.
Parameters:
index - index of the Table