?? process.asp
字號(hào):
<!--#include file="inc/inc_syssite.asp"-->
<%
dim formsize,mydata,freesize,maxsize,FilePath,my_name,filename
response.buffer=true
formsize=request.totalbytes
mydata=request.binaryread(formsize)
if not oblog.checkuserlogined() then
response.Write("登錄后才能保存大頭貼")
response.End()
end if
maxsize=oblog.l_Group(24,0)
freesize=int(maxsize-oblog.l_uUpUsed/1024)
if formsize/1024>freesize then
response.Write("空間已滿,請(qǐng)清理上傳文件。")
response.end
end if
if upload_dir<>"" then
FilePath=upload_dir
else
FilePath = oblog.l_udir&"/"&oblog.l_ufolder&"/upload"
end if
FilePath=CreatePath(FilePath)
filename=FormatName("jpg")
my_name= FilePath&filename
Call SaveStream(my_name,mydata)
oblog.execute("update oblog_user set user_upfiles_size=user_upfiles_size+"&formsize&" where userid="&oblog.l_uid)
oblog.execute("Insert into oblog_upfile (userid,file_name,file_path,file_ext,file_size,isphoto,sysclassid,userclassid,isBigHead) values ("&oblog.l_uid&",'"&filename&"','"&my_name&"','jpg',"&formsize&",1,0,0,1)")
Response.Write my_name
Sub SaveStream(paR_strFile, paR_streamContent)
Dim objStream
Set objStream =Server.CreateObject("ADODB.Stream")
with objStream
.Type =1
.Open
.Write paR_streamContent
.SaveToFile Server.Mappath(paR_strFile), 2
.Close()
End with
Set objStream =Nothing
End Sub
'檢查上傳目錄,若無(wú)目錄則自動(dòng)建立
Function CreatePath(PathValue)
Dim objFSO,Fsofolder,uploadpath
if upload_dir<>"" then
uploadpath = year(Date) & "-" & month(Date)
else
uploadpath=""
end if
If Right(PathValue,1)<>"/" Then PathValue = PathValue&"/"
On Error Resume Next
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Server.MapPath(PathValue & uploadpath))=False Then
objFSO.CreateFolder Server.MapPath(PathValue & uploadpath)
End If
If Err.Number = 0 and upload_dir<>"" Then
CreatePath = PathValue & uploadpath & "/"
Else
CreatePath = PathValue
End If
Set objFSO = Nothing
End Function
Function FormatName(Byval FileExt)
Dim RanNum,TempStr
Randomize
RanNum = Int(900000*rnd)+100000
'TempStr = Year(now) & Month(now) & Day(now) & RanNum & "." & FileExt
TempStr = Month(now) & Day(now) & RanNum & "." & FileExt
FormatName = TempStr
End Function
%>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -