I'm receiving the follow error when I attempt to upload a course object or file:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function sl_upload(), 2 passed in /home1/atlastm/public_html/appLms/modules/htmlpage/htmlpage.php on line 233 and exactly 3 expected in /home1/atlastm/public_html/lib/lib.upload.php:74 Stack trace: #0 /home1/atlastm/public_html/appLms/modules/htmlpage/htmlpage.php(233): sl_upload('/tmp/phpWOIzKA', '/appLms/htmlpag...') #1 /home1/atlastm/public_html/appLms/modules/htmlpage/htmlpage.php(86): save_file(Array) #2 /home1/atlastm/public_html/appLms/modules/htmlpage/htmlpage.php(247): inspage() #3 /home1/atlastm/public_html/appLms/class.module/class.definition.php(105): include('/home1/atlastm/...') #4 /home1/atlastm/public_html/appLms/index.php(84): LmsModule->loadBody() #5 {main} thrown in /home1/atlastm/public_html/lib/lib.upload.php on line 74]
This is the fuction from htmlpage.php on line 233:
Code: Select all
function save_file($file) {
require_once(_base_.'/lib/lib.upload.php');
$path = '/appLms/htmlpages/';
if($file['name'] != '') {
$savefile = $_SESSION['idCourse'].'_'.rand(0,100).'_'.time().'_'.$file['name'];
if(!file_exists($GLOBALS['where_files_relative'].$path.$savefile)) {
sl_open_fileoperations();
if(!sl_upload($file['tmp_name'], $path.$savefile)) {
$savefile = '';
}
sl_close_fileoperations();
return $savefile;
}
}
Code: Select all
`function sl_upload( $srcFile, $dstFile, $file_ext) {
$uploadType = Get::cfg('uploadType', null);
require_once(_lib_.'/lib.mimetype.php');
$upload_whitelist =Get::sett('file_upload_whitelist', 'rar,exe,zip,jpg,gif,png,txt,csv,rtf,xml,doc,docx,xls,xlsx,ppt,pptx,odt,ods,odp,pdf,xps,mp4,mp3,flv,swf,mov,wav,ogg,flac,wma,wmv,jpeg');
$upload_whitelist_arr =explode(',', trim($upload_whitelist, ','));
if (!empty($upload_whitelist_arr)) {
$valid_ext = false;
$ext=strtolower(substr(strrchr($dstFile, "."), 1));
if($ext!=""){
$file_ext =strtolower(substr(strrchr($dstFile, "."), 1));
}
foreach ($upload_whitelist_arr as $k=>$v) { // remove extra spaces and set lower case
$ext =trim(strtolower($v));
$mt =mimetype($ext);
if ($mt) { $mimetype_arr[]=$mt; }
getOtherMime($ext, $mimetype_arr);
if ($ext == $file_ext) {
$valid_ext =true;
}
}
$mimetype_arr = array_unique($mimetype_arr);
if ( class_exists('finfo') && method_exists('finfo', 'file')) {
$finfo =new finfo(FILEINFO_MIME_TYPE);
$file_mime_type =$finfo->file($srcFile);
}
else {
$file_mime_type =mime_content_type($srcFile);
}
if (!$valid_ext || !in_array($file_mime_type, $mimetype_arr)) {
return false;
}
}
$dstFile =stripslashes($dstFile);
if( $uploadType == "ftp" ) {
return sl_upload_ftp( $srcFile, $dstFile );
} elseif( $uploadType == "cgi" ) {
return sl_upload_cgi( $srcFile, $dstFile );
} elseif( $uploadType == "fs" || $uploadType == null ) {
return sl_upload_fs( $srcFile, $dstFile );
} else {
$event = new \appCore\Events\Core\FileSystem\UploadEvent($srcFile, $dstFile);
\appCore\Events\DispatcherManager::dispatch(\appCore\Events\Core\FileSystem\UploadEvent::EVENT_NAME, $event);
unlink($srcFile);
return $event->getResult();
}
}