=====Files Handler=====
>>==See also:==
Documentation: FilesHandlerInfo.>>This is the development page for the Files handler.::c::
This is another a complete refactoring of the FilesManagementHandler I proposed previously. The new overview can be found at FilesManagementSolution
===Dependancy===
None.
===The code===
//to be saved as files.php in the handlers/page directory.//
%%(php;1)
'') {
// link to download a file
if ($text == '') $text = $download;
echo "
href('files.xml',$this->GetPageTag(),'action=download&file='.urlencode($download))."\">".$text."";
} elseif ($this->page AND ($this->method <> 'print.xml') AND ($this->method <> 'edit')) {
// upload path
if ($this->config['upload_path'] == '') $this->config['upload_path'] = 'files';
$upload_path = $this->config['upload_path'].'/'.$this->GetPageTag();
if (! is_dir($upload_path)) mkdir_r($upload_path);
// upload action
$uploaded = $_FILES['file'];
if ($_REQUEST['action'] == 'upload' AND $uploaded['size'] > 0)
copy ($uploaded['tmp_name'], $upload_path.'/'.$uploaded['name']);
// form
$result = "
%%
===To Do===
More comments in the code - comments standardization...
----
CategoryDevelopmentHandlers