JSPSMARTUPLOAD : DOCUMENTATION
File Object
Last modified: March 1st, 2000
© 2000 Advantys. All rights reserved.

getBinaryData

The getBinaryData property contains 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 (i=0;i<myUpload.getFiles().getFile(0).getSize();i++) {
    out.println(myUpLoad.getFiles().getFile(0).getBinaryData(i));
}
%>

fileToField

The fileToField method saves file in a field of a specified DataBase.

Syntax
.fileToField(rs,ColumnName)

Parameters
rs is the RecordSet.
ColumnName is the field's name of the RecordSet which will contain the file.

Example

<%
myUpload.getFiles().getFile(0).fileToField(myRS,"FILE");
%>

getContentDisp

The getContentDisp property contains the content-disposition of field Data.

Syntax
.getContentDisp

Return Value
Returns a String value.

Example

<%
out.println("
Content-disposition=" + myUpLoad.getFiles().getFile(0).getContentDisp());
%>

getContentString

The getContentString property contains contents of the file.

Syntax
.getContentString

Return Value
Returns a String value.

Example

<%
out.println("Contents=" + myUpLoad.getFiles().getFile(0).getContentString());
%>

getContentType

The getContentType property contains the Content-Type of field Data.

Syntax
.getContentType

Return Value
Returns a String value.

Example

<%
out.println("
Content-Type=" + myUpLoad.getFiles().getFile(0).getContentType());
%>

getFieldName

The getFieldName property contains the value of the attribute NAME of the  <INPUT TYPE='file'> Tag.

Syntax
.getFieldName

Return Value
Returns a String value.

Example

<%
out.println("Name=" + myUpLoad.getFiles().getFile(0).getFieldName());
%>

getFileExt

The getFileExt property contains the extension of the file.

Syntax
.getFileExt

Return Value
Returns a String value.

Example

<%
out.println("Extension=" + myUpLoad.getFiles().getFile(0).getFileExt());
%>

getFileName

The getFileName property contains the name of the file.

Syntax
.getFileName

Return Value
Returns a String value.

Example

<%
out.println("FileName=" + myUpLoad.getFiles().getFile(0).getFileName());
%>

getFilePathName

The getFilePathName property contains the full path of the file.

Syntax
.getFilePathName

Return Value
Returns a String value.

Example

<%
out.println("Path=" + myUpLoad.getFiles().getFile(0).getFilePathName());
%>

getSize

The getSize property contains the file's size.

Syntax
.getSize

Return Value
Returns a int value.

Example

<%
out.println("
Size=" + myUpLoad.getFiles().getFile(0).getSize());
%>

getSubTypeMIME

The getSubTypeMIME property contains the sub-Type of the file.

Syntax
.getSubTypeMIME

Return Value
Returns a String value.

Example

<%
out.println("MIME Sub-Type=" + myUpLoad.getFiles().getFile(0).getSubTypeMIME());
%>

getTypeMIME

The getTypeMIME property contains the Type of the file (application, audio, image,multipart, text, video, ... ).

Syntax
.getTypeMIME

Return Value
Returns a String value.

Example

<%
out.println("
MIME Type=" + myUpLoad.getFiles().getFile(0).getTypeMIME());
%>

isMissing

The isMissing property returns a boolean which indicates if user has not specified a file.

Syntax
.isMissing

Return Value
Returns a Boolean value.

Example

<%
if (myUpLoad.getFiles().getFile(0).isMissing()) {
    out.println("There is no specified file.");
}
%>

saveAs

The saveAs method saves file in the specified directory. This method always overwrites existing files.

Syntax
.saveAs (FilePathName [, Option])

Parameter
FilePathName is the destination directory with the file's name. It could be a physical or a virtual path. If there is only the file's name then this one will be saved on 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.

Examples

<%
myUpload.getFiles().getFile(0).saveas "c:\\"+myUpload.getFiles().getFile(0).getFilename();
myUpload.getFiles().getFile(1).saveas "/docs/"+myUpload.getFiles.getFile(1).getFilename();
myUpload.getFiles().getFile(2).saveas "myFile.txt";
%>

© 2000 Advantys. All rights reserved.