JSPSMARTUPLOAD : DOCUMENTATION |
SmartUpload Object Last modified: March 1st, 2000 © 2000 Advantys. All rights reserved. |
The downloadField method.
Syntax
.downloadField(SourceField, ColumnName [, ContentType, NewFileName])
Parameter
SourceField is the record of a DataBase.
ColumnName is the name of the field containing the file.
ContentType is the content type of the file.
NewFileName indicates a new name in the "Save As" dialog box.Example
<%
myUpload.downLoadField(myRecordSet, "FILE", "application/x-zip-compressed", "NewFileName.txt");
%>
The downloadFile method.
Syntax
.downloadFile(SourceFile[, ContentType, NewFileName, blockSize])
Parameter
SourceFile is the source file. The path can be a virtual or a physical path. If there is only a file name, then this one have to be placed in the root directory of the web server.
ContentType.
NewFileName indicates a new name in the "Save As" dialog box.
blockSize set the size of a bloc loaded in memory.Example
<%
myUpload.downloadFile "/temp/myFile.txt", "application/x-zip-compressed", "NewFileName.txt", 65536
%>
The fieldToFile method writes file from a DataBase to a specified directory. This method creates a new file.
Syntax
.fieldToFile FieldName(SourceField, ColumnName, DestinationFile)Parameters
SourceField is the resultset obtain from a DataBase.
ColumnName is the name of the field containing the file.
DestinationFile is the file destination.Example
<%
myUpload.fieldToFile(myRecordSet, "FILE", "/temp/myFile.txt");
%>
The getBinaryData property returns the Byte corresponding to the table index containing the transmitted data.
Syntax
.getBinaryData(index)Return Value
Returns a byte value.
Parameter
index is an index of the byte's Array.Example
<%
for (int i=0;i<MyUpLoad.TotalBytes;i++){
out.println( myUpload.getBinaryData(i) );
}
%>
The getFiles method returns a Files object.
Syntax
.getFilesReturn Value
A Files object.Example
<%
com.jspsmart.upload.Files myFiles = myUpload.getFiles();
%>
The getRequest method returns a request object.
Syntax
.getRequestReturn Value
A Request object.Example
<%
com.jspsmart.upload.Request myRequest = myUpload.getRequest();
%>
The getSize property contains the size in bytes of the POST form.
Syntax
.getSizeReturn Value
Returns a int value.Example
<%
out.println("Bytes=" + myUpLoad.getSize() + "<br>");
%>
The setAllowedFilesList property contains the list of file's extensions which are allowed to be uploaded. If this list is empty then all files are allowed. If the list is not empty then only the files with a specified extension are allowed. In order to allow the files without extension list must contain two commas ",,". By defect this property is empty.
Syntax
.setAllowedFilesList
Example
<%
myUpLoad.setAllowedFilesList("txt,doc,xls");
%>
The setContentDisposition property contains the string of the Content Disposition Hearders for the MIME Type.
Syntax
.setContentDipositionValues
- "attachment;"
- "inline;" for MSIE 5 users
- ""Example
<%
myUpLoad.setContentDisposition("inline;");
%>
The setDeniedFilesList property contains the list of file's extensions which are denied to be uploaded. If this list is empty then no files are denied. All the files with an extension in the DeniedFileslist are denied even if they are in the AllowedFilesList. In order to deny the files without an extension the list must contain two commas ",,". By defect this property is empty.
Syntax
.setDeniedFilesList
Example
<%
myUpLoad.setDeniedFilesList("bat,exe,com,jsp");
%>
The setDenyPhysicalPath property prevents to access a path other that a virtual path of the Web Server. By defect this property is false.
Syntax
.setDenyPhysicalPath
Example
<%
myUpLoad.setDenyPhysicalPath(true);
%>
The setMaxFileSize property contains the maximum allowed size of one file to be uploaded. If this property is null then there is no limit for the file's size uploaded. By defect this property is null.
Syntax
.setMaxFileSize
Example
<%
myUpLoad.setMaxFileSize(100000);
%>
The setTotalMaxFileSize property contains the maximum allowed size of all files to be uploaded. If this property is null then there is no limit for the total file's size uploaded. By defect this property is null.
Syntax
.setTotalMaxFileSize
Example
<%
myUpLoad.setTotalMaxFileSize(100000);
%>
The save method saves all files in the disk.
Syntax
.save( [DestinationPath], [Option])
Return value
Returns a int value which indicates how many files have been saved.
Parameter
DestinationPath is optional. If this parameter is not specified then all files will be saved in the root directory of the web server.
Option is optional. This parameter allow you to force the type of the path.
SAVE_AUTO : If the path is not a virtual path, the Save method consider this path as a physical path (by default).
SAVE_VIRTUAL : If the path is not a virtual path, the Save method return an error.
SAVE_PHYSICAL : If the path is not a physical path, the Save method return an error.Example
<%
int nbFile = 0;
myUpload.upload();
// save the file in the root of the web site
nbFile = myUpload.save("/");
nbFile = myUpload.save("/", myUpload.SAVE_AUTO);
nbFile = myUpload.save("/", myUpload.SAVE_VIRTUAL);
// save the file in the root of the disk (Unix)
nbFile = myUpload.save("/", myUpload.SAVE_PHYSICAL);
out.println(nbFile + " files saved.");
%>
The upload method.
Syntax
.uploadExample
<%
myUpload.upload();
%>
The uploadInFile method creates a new file with all data of the POST form.
Syntax
.uploadInFile (DestinationFile)Parameter
DestinationFile is the file destination.Example
<%
myUpload.uploadInFile("/myData.txt");
%>
© 2000 Advantys. All rights reserved.