if ($action == 'upload') { global $wfsConfig; if (!is_dir($_POST['uploadpath']) ) { redirect_header("filemanager.php?rootpath=".$dirpath."",1,"No Dir selected"); exit; } if (!is_writeable($_POST['uploadpath']) ) { redirect_header("filemanager.php?rootpath=".$dirpath."",1,"Path Not writable"); exit; } $upload = new uploadfile(); $upload->loadPostVars(); $upload->setMode($wfsConfig['wfsmode']); $upload->setMaxImageHight($wfsConfig['imgheight']); $upload->setMaxImageWidth($wfsConfig['imgwidth']); $upload->setMaxFilesize($wfsConfig['filesize']); if (isset($_POST['imgname']) && !empty($_POST['imgname'])) $imgname = strtolower($_POST['imgname']); $distfilename = $upload->doUploadimage($_POST['uploadpath'], $imgname); if ( $distfilename ) { redirect_header("filemanager.php?rootpath=".$_POST['uploadpath']."",1,_AM_UPLOADED); exit(); } else { xoops_cp_header(); echo"<table width='100%' border='0' cellspacing='1' cellpadding = '2'><tr><td>"; echo "<div class='confirmMsg'>";
function file_upload($articleid) { global $wfsConfig; global $wfsUploadSize; if ($articleid == 0) return 21; $error = check_post_files('filename'); if ($error != 0) return $error; $upload = new uploadfile('filename'); $upload->loadPostVars(); $upload->setMaxFilesize($wfsUploadSize); $upload->setMode($wfsConfig['wfsmode']); $distfilename = $upload->doUploadToRandumFile(XOOPS_ROOT_PATH."/".$wfsConfig['filesbasepath']); if (!$distfilename) return $upload->getErrorCode(); $file = new WfsFiles(); $file->setByUploadFile($upload); $file->setFiledescript($_POST['filedescript']); // $file->setFiletext($_POST['filetext']); $file->setgroupid($_POST['groupid']); if (empty($_POST['fileshowname'])) { $file->setFileShowName($upload->getOriginalName()); } else { $file->setFileShowName($_POST['fileshowname']); } $file->setArticleid($articleid); $ret = $file->store(); if (!$ret) return 22; return 0; }