word习题 word习题 word习题

源代码在线查看: upload_file.asp

软件大小: 2191 K
上传用户: setixp
关键词: word
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
				
				
								Const MaxPerPage=20
				dim strFileName
				dim totalPut,CurrentPage,TotalPages
				dim UploadDir,TruePath,fso,theFolder,theFile,whichfile,thisfile,FileCount,TotleSize
				strFileName="Upload_File.asp"
				
				if request("page")"" then
				    currentPage=cint(request("page"))
				else
					currentPage=1
				end if
				
				if right(SaveUpFilesPath,1)"/" then
					UploadDir="../" & SaveUpFilesPath & "/"
				else
					UploadDir="../" & SaveUpFilesPath
				end if
				TruePath=Server.MapPath(UploadDir)
				If not IsObjInstalled("Scripting.FileSystemObject") Then
					Response.Write "你的服务器不支持 FSO(Scripting.FileSystemObject)! 不能使用本功能"
				Else
					set fso=CreateObject("Scripting.FileSystemObject")
					if request("Action")="Del" then
						whichfile=server.mappath(Request("FileName")) 
						Set thisfile = fso.GetFile(whichfile) 
						thisfile.Delete True
					end if
				
				%>
				
				function ConfirmDel()
				{
				if (confirm("你真的要删除此文件吗!"))
					return true;
				else
					return false;
				}
				
				
				
					
						上 传 文 件 管 理
					
					
						
								  if fso.FolderExists(TruePath)then
					FileCount=0
					TotleSize=0
					Set theFolder=fso.GetFolder(TruePath)
					For Each theFile In theFolder.Files
						FileCount=FileCount+1
						TotleSize=TotleSize+theFile.Size
					next
				    totalPut=FileCount
					if currentpage				   		currentpage=1
				   	end if
				   	if (currentpage-1)*MaxPerPage>totalput then
						if (totalPut mod MaxPerPage)=0 then
					  		currentpage= totalPut \ MaxPerPage
					  	else
					      	currentpage= totalPut \ MaxPerPage + 1
						end if
				
				    end if
					if currentPage=1 then
						showpage2 strFileName,totalput,MaxPerPage
						showContent     	
						showpage2 strFileName,totalput,MaxPerPage
						response.write "本页共显示 " & FileCount & " 个文件,占用 " & TotleSize\1024 & " K"
				   	else
				   	   	if (currentPage-1)*MaxPerPage							showpage2 strFileName,totalput,MaxPerPage
							showContent     	
							showpage2 strFileName,totalput,MaxPerPage
							response.write "本页共显示 " & FileCount & " 个文件,占用 " & TotleSize\1024 & " K"
				       	else
				        	currentPage=1
							showpage2 strFileName,totalput,MaxPerPage
							showContent     	
							showpage2 strFileName,totalput,MaxPerPage
							response.write "本页共显示 " & FileCount & " 个文件,占用 " & TotleSize\1024 & " K"
				    	end if
					end if
				  else
					response.write "找不到文件夹!可能是配置有误!"
				  end if
				end if
				
				sub showContent()
				   	dim c
					FileCount=0
					TotleSize=0
				%>
				      
				         
				          文件名
				          文件大小
				          文件类型
				          最后修改时间
				          操作
				        
								For Each theFile In theFolder.Files
					c=c+1
					if FileCount>=MaxPerPage then
						exit for
					elseif c>MaxPerPage*(CurrentPage-1) then
				%>
				         
				           
				          字节
				          
				          
				          删除
				        
										FileCount=FileCount+1
						TotleSize=TotleSize+theFile.Size
					end if
				Next
				%>
				      
				      				end sub
				%>
						
					
				
				
				  
				  				sub showpage2(sfilename,totalnumber,maxperpage)
					dim n, i,strTemp
					if totalnumber mod maxperpage=0 then
				    	n= totalnumber \ maxperpage
				  	else
				    	n= totalnumber \ maxperpage+1
				  	end if
				  	strTemp= ""
					strTemp=strTemp & "共 " & totalnumber & " 个文件,占用 " & TotleSize\1024 & " K   "
					sfilename=JoinChar(sfilename)
				  	if CurrentPage				    		strTemp=strTemp & "首页 上一页 "
				  	else
				    		strTemp=strTemp & "首页 "
				    		strTemp=strTemp & "上一页 "
				  	end if
				
				  	if n-currentpage				    		strTemp=strTemp & "下一页 尾页"
				  	else
				    		strTemp=strTemp & "下一页 "
				    		strTemp=strTemp & "尾页"
				  	end if
				   	strTemp=strTemp & " 页次:" & CurrentPage & "/" & n & "页 "
				    strTemp=strTemp & " " & maxperpage & "" & "个文件/页"
					strTemp=strTemp & " 转到:"   
				    for i = 1 to n   
				   		strTemp=strTemp & "						if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
						strTemp=strTemp & ">第" & i & "页"   
					next
					strTemp=strTemp & ""
					strTemp=strTemp & ""
					response.write strTemp
				end sub
				%>
				
							

相关资源