I create a module with ctlmodulemaker.
this is file upload code in action.addfiles.php
Code: Select all
foreach($_FILES as $fieldname=>$file){
if($fieldname != $zipfield && isset($file['name']) && $file['name'] != ""){
$extension = strtolower(substr(strrchr($file['name'], "."),1));
if( !$allowedext || in_array($extension, $allowedext) ){
if( $filepath = $this->plUploadFile($file, $destination, $resize, isset($params['crop'])) ){
$this->plAssignFile($filepath, $params['tablename'], $itemid, $params['field'], $thumbsize, isset($params['cropthumb']));
}else{
$errors .= "<li>".$file['name'].': '.lang('filenotuploaded')."</li>";
}
}else{
$errors = '<li>'.$file['name'].': '.$this->Lang('error_wrongfiletype').'</li>';
}
}
}
Code: Select all
echo '<div id="fileinputs"><p>'.$this->CreateFileUploadInput($id,'uploadfile').'</p></div>';
regards.