''.$this->up_max.''K 的文件!'');
}
}
} else {
foreach ($this->up_files as $up_file) {
$up_ext = end(explode(''.'', $up_file[''name'']));
$up_allw = false;
foreach ($this->up_ext as $ext) {
if ($up_ext == $ext) {
$up_allw = true; break;
}
}
!$up_allw && exit(''不允许上传.''.$up_ext.''格式的文件!'');
if ($up_file[''size''] / 1024 > $this->up_max) {
exit(''不允许上传大于 ''.$this->up_max.''K 的文件!'');
}
}
}
$this->Uploading();
}
private function Uploading() {
if (IO::DIRCreate($this->up_dir)) {
if (chmod($this->up_dir, 0777)) {
if (!empty($this->up_files)) {
foreach ($this->up_files as $up_file) {
if (is_uploaded_file($up_file[''tmp_name''])) {
$file_name = $up_file[''name''];
if ($this->up_rename) {
$file_ext = end(explode(''.'', $file_name));
$file_rnd = substr(md5(uniqid()), mt_rand(0, 26), 6);
$file_name = date(''ymdHis'').''_''.$file_rnd.''.''.$file_ext;
}
$file_name = $this->up_dir.''/''.$file_name;
if (move_uploaded_file($up_file[''tmp_name''], $file_name)) {
$this->up_ret[] = str_replace(WEBSITE_DIRROOT, '''', $file_name);
} else {
exit(''文件上传失败!'');
}
}
}
}
} else {
exit(''未开启写入权限!'');
}
} else {
exit(''上传目录创建失败!'');
}
}
public function GetUpload() {
return empty($this->up_ret) ? false : $this->up_ret;
}
function __destruct() {}
}
?>
asp:
复制代码 代码如下:
<%
Class MultiUpload
REM PUBLIC-VARIANT
Public Form, IsFinished
Private b
vbCrlf, bSeparate, fPassed, formData, fileType, fileSize, folderPath, _
fRename, fIMGOnly, itemCount, chunkSize, bTime, sErrors, sAuthor, sVersion
Private itemStart(), itemLength(), dataStart(), dataLength(), itemName(), itemData(), extenArr(), httpArr()
REM CLASS-INITIALIZE
Private Sub Class_Initialize
Call InitVariant
Server.ScriptTimeOut = 1800
Set Form = Server.CreateObject("Scripting.Dictionary")
sAuthor = "51JS.COM-ZMM"
sVersion = "MultiUpload Class 3.0"
End Sub
REM CLASS-ATTRIBUTES
Public Property Let AllowType(byVal sType)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "^(\w+\|)*\w+$"
regEx.Global = False
regEx.IgnoreCase = True
If regEx.Test(sType) Then fileType = "|" & Ucase(sType) & "|"
Set regEx = Nothing
End Property
Public Property Let MaxSize(byVal sSize)
If IsNumeric(sSize) Then fileSize = CDbl(FormatNumber(CCur(sSize), 2))
End Property
Public Property Let SaveFolder(byVal sFolder)
folderPath = sFolder
End Property
Public Property Let CommonPassed(byVal bCheck)
fPassed = bCheck
End Property
Public Property Let FileRenamed(byVal bRename)
fRename = bRename
End Property
Public Property Let FileIsAllImg(byVal bOnly)
fIMGOnly = bOnly
End Property
Public Property Get SaveFolder
SaveFolder = folderPath
End Property
Public Property Get FileRenamed
FileRenamed = fRename
End Property
Public Property Get FileIsAllImg
FileIsAllImg = fIMGOnly
End Property
Public Property Get ErrMessage
ErrMessage = sErrors
End Property
Public Property Get ClsAuthor
ClsAuthor = sAuthor
End Property
Public Property Get ClsVersion
ClsVersion = sV