CodeCharge Studio All ASP PHP Perl ColdFusion Java C#.NET VB.NET

File Upload Component Reference

Design-Time Properties

Property Description
Name A unique name used to identify the instance of the control.
Caption You can use this property to set a name that will be used to refer to the control within error messages. If a value is not specified for this property, the value of the Name property above is used by default. Since control names are often cryptic by nature, it is advisable to set a more readable caption which will better help the user understand what the error message is referring to.
Control Source Type The type of data source from which the control gets its value. This can be one of the following:
  • Database Column – The control value will come from a column within a database table.
  • Code Expression – The control value will be derived from an expression specific to the particular programming language being used. This could be a function that returns a value, a pre-existing variable or any other valid language construct that will evaluate to a definite value.

Typically, the control source is a database column where the names of the uploaded files are stored.

Control Source This property depends on the value specified in the Control Source Type property above. If the Control Source Type is a Database Column, use this property to specify the database table column that will be used to furnish the control value. Respectively, if the Control Source Type is a Database Expression or a Code Expression, enter the expression to be used to furnish the control value. This property can be left blank if the control does not use a data source.
Required [Yes/No] This property specifies whether the control must submit a file when the form is submitted. If the control does not submit a file, the form will not be processed to completion but instead an error message will be displayed.
Error Control Usually, error messages corresponding to a control are displayed at the top of the form as plain text. However, you might want this error text to be displayed within another existing control, for instance, in a Label field placed adjacent to the control. Use this property to specify the name of a control where you want the error message for the current control to be displayed.
Temporary Folder Specify a file system path to a folder on the web server machine where the upload component can temporarily place files while they are being processed. The path specified can be an absolute path e.g. c:\Inetpub\files\temp or a relative path e.g. .\files\temp
File Folder Specify a file system path to a folder on the web server machine where the final uploaded files should be stored. The path specified can be an absolute path e.g. c:\Inetpub\files\images or a relative path e.g. .\files\images
Allowed File Masks Specify a semicolon separated list of file masks for files that the user is allowed to upload e.g. *.jpg; *.png; *.gif; *.txt. You can enter an asterisk (*) to allow all file types to be uploaded.
Disallowed FIle Masks Specify a semicolon separated list of file masks for files that the user is not allowed to upload e.g. *.exe; *.dll; *.bat.
File Size Limit Specify the size limit in bytes of the files that the user can upload. Files larger than the limit will not be uploaded.

Events

Event Description
Server Side Events
Before Process File This event occurs after an uploaded file is saved to the temporary directory but before it is moved to the target folder. This event can be used to check additional conditions or to change the file location or name.
After Process File This event occurs after an uploaded file is moved to the target folder from the temporary folder. It can be used to perform post processing on the file.
Before Delete File This event occurs before a file is deleted from the server. It can be used to check additional permissions or conditions before deleting the file.
After Delete File This event occurs after a file has been deleted from the server. It can be used to perform cleanup operations after removing the file.
Before Show This event occurs before the control is rendered to the page.
On Validate This event occurs after standard validation operations have been performed as a result of submitting values, but before any database operations have been performed with the submitted values.

Run-Time Properties (ASP)

Property Description
AllowedFileMasks  This property contains a list of file masks for files that the user is allowed to upload.
DisallowedFileMasks  This property contains a list of file masks for files that the user is not allowed to upload.
Errors  This property keeps a reference to the objectís error collection. It is used to collect error messages generated during the objectís execution.
FileFolder  This property specifies a file system path to a folder on the web server machine where the final uploaded files should be stored.
FileSize  This property contains the actual size on an uploaded file.
FileSizeLimit  This property specifies the size limit in bytes of the files that the user can upload. Files larger than the limit will not be uploaded.
IsUploaded  This property indicated the control's processing state. If true, the file has been uploaded and is waiting for processing. If false, no file was selected for uploading.
TemporaryFolder  This property specifies a file system path to a folder on the web server machine where the upload component can temporarily place files while they are being processed.
Value  This property contains the name of the uploaded file.
Visible  This property determines whether the control is displayed or not. In order for this property to work, the extended HTML comments have to be defined for the control.

Run-Time Properties (PHP)

Property Description
AllowedFileMasks  This property contains a list of file masks for files that the user is allowed to upload.
ComponentType Specifies type of an object, such as "TextBox", "Record", etc.
Parent Specifies parent container of an object, for example a record form for a textbox that is included within that form.
DisallowedFileMasks  This property contains a list of file masks for files that the user is not allowed to upload.
Errors  This property keeps a reference to the objectís error collection. It is used to collect error messages generated during the objectís execution.
FileSizeLimit  This property specifies the size limit in bytes of the files that the user can upload. Files larger than the limit will not be uploaded.
FileFolder  This property specifies a file system path to a folder on the web server machine where the final uploaded files should be stored.
TemporaryFolder  This property specifies a file system path to a folder on the web server machine where the upload component can temporarily place files while they are being processed.
Visible  This property determines whether the control is displayed or not.

Run-Time Properties (.NET)

Property Description
Text  This property contains the name of the uploaded file.
AllowedFileMasks  This property contains a list of file masks for files that the user is allowed to upload.
DisallowedFileMasks  This property contains a list of file masks for files that the user is not allowed to upload.
FileSizeLimit  This property specifies the size limit in bytes of the files that the user can upload. Files larger than the limit will not be uploaded.
FileFolder  This property specifies a file system path to a folder on the web server machine where the final uploaded files should be stored.
TemporaryFolder  This property specifies a file system path to a folder on the web server machine where the upload component can temporarily place files while they are being processed.
Required  This property indicates whether a value must be specified in the control in order for the form to be submitted successfully.
Visible  This property determines whether the control is displayed or not.

Methods (.NET)

Method Description
ValidateFile  Validate an uploaded file and if validation is successful, save the file to the TemporaryFolder.
SaveFile  Save a file to the specified FileFolder.
DeleteFile  Delete a file from the server .

Methods (ASP)

Method Description
GetOriginFileName  This method can be used to retrieve the original name of the uploaded file i.e. without the unique timestamp appended to the filename.

Methods (PHP)

Method Description
GetFileName  This method can be used to retrieve the original name of the uploaded file i.e. without the unique timestamp appended to the filename.
GetFileSize  This method can be used to retrieve the size of the uploaded file.
GetValue  This method retrieves the name of the uploaded file.
SetValue  This method sets the name of the uploaded file.

Run-Time Variables (CF,CFT)

Variable Description
fld<control name> This variable contains the name of the uploaded file.
par<control name>.TemporaryFolder This variable specifies a file system path to a folder on the web server machine where the upload component can temporarily place files while they are being processed
par<control name>.FileFolder This variable specifies a file system path to a folder on the web server machine where the final uploaded files should be stored.
hide<control name> This variable determines whether the control is displayed or not.

Methods (Servlets & JSP)

MethodDescription
getPage Get the page that contains this control.
getFormattedValue Get the control value formatted according to the control format.
setFormattedValue Set the control value using a String. The value is taken as is i.e. formatting will not be applied to this value.
hasErrors Whether the control has (validation) errors.
addError Add an error description to the errors collection.
getErrorsAsString Return a single String with all the error messages separated by &lt;br&gt; tags.
isVisible Whether this control should be shown or not.
setVisible Specify whether this control or component should be shown or not.
getParent Get the parent component that contains this control or component.

See also:

File Upload Overview


On-line, printable versions and updates