asp文件操作大全
<%
Class Cls_FSO
Public objFSO
Private Sub Class_Initialize()
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
End Sub
Private Sub class_terminate()
Set objFSO = Nothing
End Sub
'=======文件操作========
'取文件大小
Public Function GetFileSize(FileName)
Dim f
If ReportFileStatus(FileName) = 1 Then
Set f = objFSO.Getfile(FileName)
GetFileSize = f.Size
Else
GetFileSize = -1
End if
End Function
'文件删除
Public Function deleteAFile(FileSpec)
If ReportFileStatus(FileSpec) = 1 Then
objFSO.deleteFile(FileSpec)
deleteAFile = 1
Else
deleteAFile = -1
End if
End Function
'显示文件列表
Public Function ShowFileList(FolderSpec)
Dim f, f1, fc, s
If ReportFolderStatus(FolderSpec) = 1 Then
Set f = objFSO.GetFolder(FolderSpec)
Set fc = f.Files
For Each f1 in fc
s = s & f1.name
s = s & "|"
Next
ShowFileList = s
Else
ShowFileList = -1
End if
End Function
'文件复制
Public Function CopyAFile(SourceFile, DestinationFile)
Dim MyFile
If ReportFileStatus(SourceFile) = 1 Then
Set MyFile = objFSO.GetFile(SourceFile)
MyFile.Copy (DestinationFile)
CopyAFile = 1
Else
CopyAFile = -1
End if
End Function
'文件移动
Public Function MoveAFile(SourceFile,DestinationFile)
If ReportFileStatus(SourceFile) = 1 And ReportFileStatus(DestinationFileORPath) = -1 Then
objFSO.MoveFile SourceFile,DestinationFileORPath
MoveAFile = 1
Else
MoveAFile = -1
End if
End Function
'文件是否存在?
Public Function ReportFileStatus(FileName)
Dim msg
msg = -1
If (objFSO.FileExists(FileName)) Then
msg = 1
Else
msg = -1
End If
ReportFileStatus = msg
End Function
'文件创建日期
Public Function ShowDatecreated(FileSpec)
Dim f
If ReportFileStatus(FileSpec) = 1 Then
Set f = objFSO.GetFile(FileSpec)
ShowDatecreated = f.Datecreated
Else
ShowDatecreated = -1
End if
End Function
'文件属性
Public Function GetAttributes(FileName)
Dim f
Dim str
相关文档:
asp连接access和mssql的万能代码:
'解决了ACCESS数据库路径的问题!
'采用DBType=0或DBType=1来区分AC库还是MSSQL库
'具体采用AC库时应注意的事项,请看程序说明
-----------------------------------------------
Dim DBType,Conn,StrConn
DBType=0 '0为Access数据库,1为MSSQL数据库
If(DBType=0) Then
......
http://www.w3school.com.cn/asp/met_mappath.asp
定义和用法
MapPath 方法可把指定的路径影射到服务器上相应的物理路径上。
注释:此方法不能用于 Session.OnEnd 和 Application.OnEnd 中。
实例
实例 1
举例,文件 test.asp 位于 C:\Inetpub\wwwroot\Script。
文件 Test.asp (位于 C:\Inetpub\wwwroot\Script) 包� ......
IIS无法访问asp!
解决办法!今天打开电脑发现IIS无法访问asp页面。
提示:Server Application Error 然后就有了下面的一段话。
The server has encountered an error while loading an application during the processing of your request. Please refer to the event log for more detail information. Please contact ......
<script>window.parent.document.getElementById('BIframe').src='B.aspx';</script>
http://www.cnblogs.com/lijigang/archive/2007/05/18/751943.html
再来看看第二种刷新方法:“重载页面”
<script>window.parent.document.frames.BIframe.RefreshmyForm();</script>
<scri ......
与ASP相比,ASP.NET在很多方面有了显著的改进,这些方面包括:性能、状态管理、可缩放性、配置、部署、安全性、输出缓存控制、网络场支持和XML Web services结构等。
如果您具有ASP 开发技能,则新的 ASP.NET 编程 ......