w3Upload Reference

Reference w3FormField

 w3.FormField
    ContentType : String
    FileName : String
    IsFile : Boolean
    Item : String
    Name : String
    Size : Integer
    IsEmpty() : Boolean
    SaveAsUniqueFile( bstrFileName ) : String
    SaveToADODBField( ADODBField ) : 
    SaveToFile( bstrFileName ) : 


Properties

  ContentType : String
(v1.0)
Returns the contentType of the uploaded file. Only works on file fields.
var fileField = upLoad.Form( "theFile" );
var type = new String ( fileField.ContentType );
// type now contains the content type of the file
// for example: 'image/pjpeg'

  FileName : String
(v1.0)
The name of the originally uploaded file
var fileField = upLoad.Form( "theFile" );
var fileName = new String ( fileField.FileName );
// fileName contains the name of original file, including full path, as found on
// the computer. For example: 'D:\pictures\mypicture.jpg'

  IsFile : Boolean
(v1.0)
Returns true if the field is a File
var fileField = upLoad.Form( "theFile" );
var isFile = new Boolean ( fileField.IsFile );
// isFile is true when the field is of file type

  Item : String
(v1.0)
Value of this field. Returns the string if it is a textfield and so on.
var fileName = upLoad.Form( "theFileName" );
var value = new String ( fileField.FileName );
// value now contains the name (the input field 'theFileName' is of text type)

  Name : String
(v1.0)
Returns the name of the inputfield as specified in the HTML of the submitting formpage.
var fileField = upLoad.Form.Items( 1 );
var fieldName = new String ( fileField.Name );
// fieldName now contains the name of the field - in this case: 'theFile'

  Size : Integer
(v1.0)
Returns the size of the field/file
var fileField = upLoad.Form( "theFile" );
var fileSize = new Number ( fileField.Size );
// fileSize now contains the size of the file

Methods

  IsEmpty()  : Boolean
(v1.0)
Returns true if the field is empty.

Note: Not yet implemented.

  SaveAsUniqueFile(bstrFileName)  : String
(v1.0)
Saves the file as a Unique file and returns the new name. Adds a numbering at the end of the given filename.

Same as 'SaveToFile' except for this numbering feature.
// In the receiving code for a HTTP form the following saves a file submitted in the
// field named 'theFile'

file = upLoad.Form( 'theFile' ); // a reference to a field object is created
var theName = file.SaveAsUniqueFile( "D:\\uploadSite\\uploadedFiles\\uploadedfile.txt" ); 

// the field (the file) is saved on the server in the catalog: "D:\uploadsite\uploadedFiles\"
// with the name "uploadedfile.txt" or "uploadedfile(1).txt" if it already exists,
// or "uploadedfile(2).txt" and so on
// it returns the name into variable 'theName'

  SaveToADODBField(ADODBField)
(v1.0)
Saves the Field to an ADODBField

Note: Not fully implemented yet

  SaveToFile(bstrFileName)
(v1.0)
Saves the field to disk. The most obvious usage is for saving an uploaded file on the server and thus applying the method on a field of 'FILE' type.
// In the receiving code for a HTTP form the following saves a file submitted in the
// field named 'theFile'

file = upLoad.Form( 'theFile' ); // a reference to a field object is created
file.SaveToFile( "D:\\uploadSite\\uploadedFiles\\uploadedfile.txt" ); 

// the field (the file) is saved on the server in the catalog: "D:\uploadsite\uploadedFiles\"
// with the name "uploadedfile.txt"