[1012]PHP進階開發及TadTools工具應用
<?php
include_once "header.php";
include_once XOOPS_ROOT_PATH."/modules/tadtools/jupload/jupload.php";
if(!$xoopsUser) die('無上傳權限');
if($_GET['op']=='import'){
if ($dh = opendir(XOOPS_ROOT_PATH."/uploads/contact/video")) {
while (($file = readdir($dh)) !== false) {
if(strlen($file)<=2)continue;
$f=explode(".",$file);
$ext=strtolower($f[1]);
rename(XOOPS_ROOT_PATH."/uploads/contact/video/{$file}",XOOPS_ROOT_PATH."/uploads/contact/{$_GET['sn']}.{$ext}");
die("請點擊「影片」以觀看之");
}
}
}else{
$appletParameters = array(
'maxFileSize' => '2G',
'postURL' => XOOPS_URL.'/modules/contact/jupload.php',
'archive' => XOOPS_URL.'/modules/tadtools/jupload/wjhk.jupload.jar',
'afterUploadURL' => XOOPS_URL."/modules/contact/index.php?sn={$_GET['sn']}&op=import",
'allowedFileExtensions' => 'flv/mp4',
'sendMD5Sum' => 'true',
'showLogWindow' => 'false',
'debugLevel' => 99
);
$classParameters = array(
'demo_mode' => false,
'allow_subdirs' => true,
'destdir' => XOOPS_ROOT_PATH."/uploads/contact/video"
);
$juploadPhpSupportClass = new JUpload($appletParameters, $classParameters);
echo "<!--JUPLOAD_APPLET-->";
}
?>