FormField
|
+--FileField
|
+--UploadField
public class UploadField
extends FileField
Field Summary | |
---|---|
mixed | True if all files, even those with prohibited extensions can be uploaded. |
mixed | The sub field for the clear button, that clears the upload. |
mixed | True if the upload now button should be displayed and activated. |
mixed | The value of PHP's $_FILES array: name, type, size, tmp_name, error as set by PHP when a file has been successfully uploaded. |
mixed | The max file size in bytes permitted. |
mixed | True if a file has already been uploaded or false otherwise. |
mixed | An array of partial extensions that cannot be uploaded with this field. |
mixed | True if an empty sub field constitutes an invalid value. |
mixed | The local path to the directory where this file should be uploaded. |
mixed | The URL to the directory where this file should be uploaded. |
mixed | The sub field for the upload button that uploads the file now, instead of waiting for the entire form to be submitted to upload the file. |
mixed | The URL to the uploaded file. |
mixed | A sub field for propagating uploadedFile. |
mixed | The filename of the uploaded file. |
mixed | The local path to the uploaded file. |
Fields inherited from FORMfields.fields.FileField | |
---|---|
MAX_SIZE |
Fields inherited from FORMfields.fields.FormField | |
---|---|
autoPropagate, data, disableEnterHandler, displayValuesOnNewLine, editable, enabled, endingString, enterTabHandler, enterTabs, error, extraHtml, fieldBelowLabel, formError, help, hidden, htmlify, id, isData, label, labelForId, multiValues, name, required, subFieldDisplayValueSeparator, subFieldSeparator, subFieldValueSeparator, subFields, subFieldsCannotBeEmpty, trimWhitespace, validators, value, valueIsHtml |
Constructor Summary | |
---|---|
UploadField(string name, string label, int required, int maxFileSize, int uploadDir, int uploadDirUrl) Creates a new UploadField. |
|
__construct(string name, string label, int required, int maxFileSize, int uploadDir, int uploadDirUrl) Creates a new UploadField. |
Method Summary | |
---|---|
string | Returns a hyperlink to the uploaded file. |
string | Returns the HTML used to display the input portion of this field. |
void | Retrieves the posted field value. |
mixed | getValue() Returns the value of this form field. |
boolean | isValid() Checks for field errors detected by this field, including a check for blank. |
void | moveUploadedFile(string destination) Moves the uploaded field to the destination path. |
void | setValue(string value) Sets the database value of this field. |
void | This method checks for any errors that may have occured while trying to upload the file. |
boolean | validExtension(string ext) Returns true if the specified extension is an extension that may be uploaded. |
Methods inherited from FORMfields.fields.FileField | |
---|---|
getEditableFieldTag |
public mixed $allowAllExts = false
True if all files, even those with prohibited extensions can be uploaded.
public mixed $clearButton = null
The sub field for the clear button, that clears the upload. Note: Clicking the clear button doesn't delete the uploaded file.
public mixed $enableUploadNow = true
True if the upload now button should be displayed and activated.
public mixed $fileProperties
The value of PHP's $_FILES array: name, type, size, tmp_name, error as set by PHP when a file has been successfully uploaded.
public mixed $maxFileSize
The max file size in bytes permitted.
public mixed $newUpload = false
True if a file has already been uploaded or false otherwise.
public mixed $prohibitedExts = array("php"
An array of partial extensions that cannot be uploaded with this field. This array should contain the extensions all files that can be executed on your web server. In this regard a file cannot be uploaded to your FORMfields/uploads directory and then executed using a web browser to perform malicious activities.
public mixed $subFieldsCannotBeEmpty = false
True if an empty sub field constitutes an invalid value.
public mixed $uploadDir
The local path to the directory where this file should be uploaded. If this parameter is omitted, the file will be uploaded to /FORMfields/uploads.
public mixed $uploadDirUrl
The URL to the directory where this file should be uploaded. If this parameter is omitted, the file will be uploaded to your FORMfields/uploads directory.
public mixed $uploadNowButton = null
The sub field for the upload button that uploads the file now, instead of waiting for the entire form to be submitted to upload the file.
public mixed $uploadedFile
The URL to the uploaded file.
public mixed $uploadedFileField
A sub field for propagating uploadedFile.
public mixed $uploadedFilename
The filename of the uploaded file.
public mixed $uploadedLocalFile
The local path to the uploaded file.
public UploadField(string name, string label, int required, int maxFileSize, int uploadDir, int uploadDirUrl)
Creates a new UploadField.
public string getDisplayHtmlValue()
Returns a hyperlink to the uploaded file.
public string getEditableFieldTag()
Returns the HTML used to display the input portion of this field.
public void getParameter()
Retrieves the posted field value. In other words, sets this field value using the appropriate values in $_REQUEST.
public mixed getValue()
Returns the value of this form field. Needed to override the parent method.
public boolean isValid()
Checks for field errors detected by this field, including a check for blank. This method checks for any errors that may have occured while trying to upload the file. If an error is detected, the setError() method is called to set the appropriate error message.
public void moveUploadedFile(string destination)
Moves the uploaded field to the destination path. Note: some web servers don't permit you to move an uploaded file, but they do permit you to copy an uploaded file.
public void setValue(string value)
Sets the database value of this field. A database value can be different than the field's actual value. For example a phone number may have the value "973-746-3233" but its database value would be "9737463233"
public void uploadFile()
This method checks for any errors that may have occured while trying to upload the file. It also checks for any invalid file extensions: "php", "phtml", "asp", "jsp", "py" or "cfm". Upon a successful upload, this method copies the file to the uploads directory.
public boolean validExtension(string ext)
Returns true if the specified extension is an extension that may be uploaded. Filenames like "myfile.php.disabled" that could otherwise be executed with PHP will pass validation with validExtension(), however a timestamp is appended to these filenames during upload and as a side effect of this, PHP will not execute these uploaded files.
UploadField is a field for selecting a file on your local computer to upload to your web server. Note: To utilize this field, you must use method="post" and enctype="multipart/form-data" in your form tag.