CWIS Developer Documentation
|
Class representing a stored (usually uploaded) file. More...
Public Member Functions | |
CreateCopy () | |
Create copy of File object. More... | |
GetLength () | |
Gets the length of the file. More... | |
GetType () | |
Gets the file's type. More... | |
Comment ($NewValue=DB_NOVALUE) | |
Gets or sets the comment on the file. More... | |
FieldId ($NewValue=DB_NOVALUE) | |
Gets or sets the field ID of the File. More... | |
ResourceId ($NewValue=DB_NOVALUE) | |
Gets or sets the resource ID of the File. More... | |
GetMimeType () | |
Gets the MIME type of the file. More... | |
GetLink () | |
Returns the relative download link to download the file. More... | |
Destroy () | |
Deletes the file and removes its entry from the database. More... | |
Delete () | |
Deprecated method to delete file and remove entry from database. More... | |
GetNameOfStoredFile () | |
Returns the relative link to the stored file. More... | |
![]() | |
__construct ($Id) | |
Constructor, used to load existing items. More... | |
Destroy () | |
Destroy item. More... | |
Delete () | |
Destroy item. More... | |
Id () | |
Get item ID. More... | |
Name ($NewValue=DB_NOVALUE) | |
Get/set name of item. More... | |
DateCreated ($NewValue=DB_NOVALUE) | |
Get/set when item was created. More... | |
CreatedBy ($NewValue=DB_NOVALUE) | |
Get/set ID of user who created the item. More... | |
DateLastModified ($NewValue=DB_NOVALUE) | |
Get/set when item was last modified. More... | |
LastModifiedBy ($NewValue=DB_NOVALUE) | |
Get/set ID of user who last modified the item. More... | |
Static Public Member Functions | |
static | Create ($SourceFile, $DesiredFileName=NULL) |
Create a new File object using an existing file. More... | |
static | GetStorageDirectory () |
Get file storage directory. More... | |
![]() | |
static | GetCanonicalId ($Id) |
Normalize item ID to canonical form. More... | |
static | ItemExists ($Id) |
Check whether an item exists with the specified ID. More... | |
Public Attributes | |
const | FILESTAT_OK = 0 |
const | FILESTAT_COPYERROR = 1 |
const | FILESTAT_PARAMERROR = 2 |
const | FILESTAT_ZEROLENGTH = 3 |
const | FILESTAT_DOESNOTEXIST = 4 |
const | FILESTAT_UNREADABLE = 5 |
![]() | |
const | NO_ITEM = -2123456789 |
ID value used to indicate no item. More... | |
Static Protected Member Functions | |
static | DetermineFileType ($FileName) |
Get MIME type for specified file, if possible. More... | |
![]() | |
static | CreateWithValues ($Values) |
Create a new item, using specified initial database values. More... | |
static | SetDatabaseAccessValues ($ClassName) |
Set the database access values (table name, ID column name, name column name) for specified class. More... | |
Additional Inherited Members | |
![]() | |
UpdateValue ($ColumnName, $NewValue=DB_NOVALUE) | |
Convenience function to supply parameters to Database::UpdateValue(). More... | |
UpdateDateValue ($ColumnName, $NewValue=DB_NOVALUE) | |
Convenience function to supply parameters to Database::UpdateValue(), with preprocessing of new values to convert them into an SQL-compatible date format. More... | |
![]() | |
$DB | |
$Id | |
$ItemIdColumnName | |
$ItemNameColumnName | |
$ItemTableName | |
$ValueCache = array() | |
![]() | |
static | $ItemIdColumnNames |
static | $ItemNameColumnNames |
static | $ItemTableNames |
File::Comment | ( | $NewValue = DB_NOVALUE | ) |
Gets or sets the comment on the file.
string | $NewValue | The new comment on the file. (OPTIONAL) |
Definition at line 137 of file File.php.
References Item\UpdateValue().
|
static |
Create a new File object using an existing file.
string | $SourceFile | Name of existing file, with absolute or relative leading path, if needed. |
string | $DesiredFileName | Desired name for file (if not the same as the existing name). (OPTIONAL). |
Definition at line 34 of file File.php.
References Item\$DB.
Referenced by FormUI_Base\HandleUploads(), File_Test\testComment(), File_Test\testCreate(), File_Test\testCreateCopy(), File_Test\testFieldId(), File_Test\testGetLength(), File_Test\testGetLink(), File_Test\testGetMimeType(), File_Test\testGetStorageDirectory(), File_Test\testGetType(), and File_Test\testResourceId().
File::CreateCopy | ( | ) |
Create copy of File object.
The copy will have a new ID, but will otherwise be identical.
Definition at line 102 of file File.php.
References FieldId(), GetNameOfStoredFile(), Item\Name(), and ResourceId().
File::Delete | ( | ) |
File::Destroy | ( | ) |
Deletes the file and removes its entry from the database.
Other methods are invalid after calling this.
Definition at line 198 of file File.php.
References GetNameOfStoredFile().
Referenced by Delete().
|
staticprotected |
File::FieldId | ( | $NewValue = DB_NOVALUE | ) |
Gets or sets the field ID of the File.
int | $NewValue | The new field ID of the File. (OPTIONAL) |
Definition at line 147 of file File.php.
References Item\UpdateValue().
Referenced by CreateCopy().
File::GetLength | ( | ) |
File::GetLink | ( | ) |
Returns the relative download link to download the file.
If .htaccess files are supported, the redirect that includes the file name is used.
Definition at line 177 of file File.php.
References Item\Name().
File::GetMimeType | ( | ) |
File::GetNameOfStoredFile | ( | ) |
Returns the relative link to the stored file.
Definition at line 225 of file File.php.
References Item\Id(), and Item\Name().
Referenced by CreateCopy(), and Destroy().
|
static |
File::GetType | ( | ) |
Gets the file's type.
Definition at line 127 of file File.php.
Referenced by GetMimeType().
File::ResourceId | ( | $NewValue = DB_NOVALUE | ) |
Gets or sets the resource ID of the File.
int | $NewValue | The new resource ID of the File. (OPTIONAL) |
Definition at line 157 of file File.php.
References Item\UpdateValue().
Referenced by CreateCopy().
const File::FILESTAT_DOESNOTEXIST = 4 |
Definition at line 23 of file File.php.
Referenced by File_Test\testCreate().
const File::FILESTAT_OK = 0 |
Definition at line 19 of file File.php.
Referenced by UserEditingUI\UploadFiles().
const File::FILESTAT_ZEROLENGTH = 3 |
Definition at line 22 of file File.php.
Referenced by FormUI_Base\HandleUploads(), File_Test\testCreate(), and UserEditingUI\UploadFiles().