对文件的操作--建立移动删除文件夹
文件 操作 删除 建立 -- 文件夹 移动
2023-06-13 09:13:46 时间
下面两个文件:
<!--#includevirtual="/intels/chunfeng/graphicdetect.asp"-->
<html>
<head>
<TITLE>图像尺寸</TITLE>
</head>
<bodybgcolor="#FFFFFF">
<%
graphic="images/intels.gif"
HW=ReadImg(graphic)
Response.Writegraphic&"Dimensions:"&HW(0)&"x"&HW(1)
&"<br>"
response.write"<imgsrc=""/"&graphic&""""
response.writeheight="""&HW(0)&"""
response.writewidth="""&HW(0)&"">"
%>
</body>
</html>
------------------------
graphicdetect.asp
<%
DimHW
FunctionAscAt(s,n)
AscAt=Asc(Mid(s,n,1))
EndFunction
FunctionHexAt(s,n)
HexAt=Hex(AscAt(s,n))
EndFunction
FunctionisJPG(fichero)
IfinStr(uCase(fichero),".JPG")<>0Then
isJPG=true
Else
isJPG=false
EndIf
EndFunction
FunctionisPNG(fichero)
IfinStr(uCase(fichero),".PNG")<>0Then
isPNG=true
Else
isPNG=false
EndIf
EndFunction
FunctionisGIF(fichero)
IfinStr(uCase(fichero),".GIF")<>0Then
isGIF=true
Else
isGIF=false
EndIf
EndFunction
FunctionisBMP(fichero)
IfinStr(uCase(fichero),".BMP")<>0Then
isBMP=true
Else
isBMP=false
EndIf
EndFunction
FunctionisWMF(fichero)
IfinStr(uCase(fichero),".WMF")<>0Then
isWMF=true
Else
isWMF=false
EndIf
EndFunction
FunctionisWebImg(f)
IfisGIF(f)OrisJPG(f)OrisPNG(f)OrisBMP(f)OrisWMF(f)
Then
isWebImg=true
Else
isWebImg=true
EndIf
EndFunction
FunctionReadImg(fichero)
IfisGIF(fichero)Then
ReadImg=ReadGIF(fichero)
Else
IfisJPG(fichero)Then
ReadImg=ReadJPG(fichero)
Else
IfisPNG(fichero)Then
ReadImg=ReadPNG(fichero)
Else
IfisBMP(fichero)Then
ReadImg=ReadPNG(fichero)
Else
IfisWMF(fichero)Then
ReadImg=ReadWMF(fichero)
Else
ReadImg=Array(0,0)
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunction
FunctionReadJPG(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile(Server.MapPath("/"&fichero),1)
s=Right(ts.Read(167),4)
HW(0)=HexToDec(HexAt(s,3)&HexAt(s,4))
HW(1)=HexToDec(HexAt(s,1)&HexAt(s,2))
ts.Close
ReadJPG=HW
EndFunction
FunctionReadPNG(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile(Server.MapPath("/"&fichero),1)
s=Right(ts.Read(24),8)
HW(0)=HexToDec(HexAt(s,3)&HexAt(s,4))
HW(1)=HexToDec(HexAt(s,7)&HexAt(s,8))
ts.Close
ReadPNG=HW
EndFunction
FunctionReadGIF(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile(Server.MapPath("/"&fichero),1)
s=Right(ts.Read(10),4)
HW(0)=HexToDec(HexAt(s,2)&HexAt(s,1))
HW(1)=HexToDec(HexAt(s,4)&HexAt(s,3))
ts.Close
ReadGIF=HW
EndFunction
FunctionReadWMF(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile(Server.MapPath("/"&fichero),1)
s=Right(ts.Read(14),4)
HW(0)=HexToDec(HexAt(s,2)&HexAt(s,1))
HW(1)=HexToDec(HexAt(s,4)&HexAt(s,3))
ts.Close
ReadWMF=HW
EndFunction
FunctionReadBMP(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile(Server.MapPath("/"&fichero),1)
s=Right(ts.Read(24),8)
HW(0)=HexToDec(HexAt(s,4)&HexAt(s,3))
HW(1)=HexToDec(HexAt(s,8)&HexAt(s,7))
ts.Close
ReadBMP=HW
EndFunction
FunctionisDigit(c)
IfinStr("0123456789",c)<>0Then
isDigit=true
Else
isDigit=false
EndIf
EndFunction
FunctionisHex(c)
IfinStr("0123456789ABCDEFabcdef",c)<>0Then
isHex=true
Else
ishex=false
EndIf
EndFunction
FunctionHexToDec(cadhex)
Dimn,i,ch,decimal
decimal=0
n=Len(cadhex)
Fori=1Ton
ch=Mid(cadhex,i,1)
IfisHex(ch)Then
decimal=decimal*16
IfisDigit(c)Then
decimal=decimal+ch
Else
decimal=decimal+Asc(uCase(ch))-Asc("A")
EndIf
Else
HexToDec=-1
EndIf
Next
HexToDec=decimal
EndFunction
%>
<!--#includevirtual="/intels/chunfeng/graphicdetect.asp"-->
<html>
<head>
<TITLE>图像尺寸</TITLE>
</head>
<bodybgcolor="#FFFFFF">
<%
graphic="images/intels.gif"
HW=ReadImg(graphic)
Response.Writegraphic&"Dimensions:"&HW(0)&"x"&HW(1)
&"<br>"
response.write"<imgsrc=""/"&graphic&""""
response.writeheight="""&HW(0)&"""
response.writewidth="""&HW(0)&"">"
%>
</body>
</html>
------------------------
graphicdetect.asp
<%
DimHW
FunctionAscAt(s,n)
AscAt=Asc(Mid(s,n,1))
EndFunction
FunctionHexAt(s,n)
HexAt=Hex(AscAt(s,n))
EndFunction
FunctionisJPG(fichero)
IfinStr(uCase(fichero),".JPG")<>0Then
isJPG=true
Else
isJPG=false
EndIf
EndFunction
FunctionisPNG(fichero)
IfinStr(uCase(fichero),".PNG")<>0Then
isPNG=true
Else
isPNG=false
EndIf
EndFunction
FunctionisGIF(fichero)
IfinStr(uCase(fichero),".GIF")<>0Then
isGIF=true
Else
isGIF=false
EndIf
EndFunction
FunctionisBMP(fichero)
IfinStr(uCase(fichero),".BMP")<>0Then
isBMP=true
Else
isBMP=false
EndIf
EndFunction
FunctionisWMF(fichero)
IfinStr(uCase(fichero),".WMF")<>0Then
isWMF=true
Else
isWMF=false
EndIf
EndFunction
FunctionisWebImg(f)
IfisGIF(f)OrisJPG(f)OrisPNG(f)OrisBMP(f)OrisWMF(f)
Then
isWebImg=true
Else
isWebImg=true
EndIf
EndFunction
FunctionReadImg(fichero)
IfisGIF(fichero)Then
ReadImg=ReadGIF(fichero)
Else
IfisJPG(fichero)Then
ReadImg=ReadJPG(fichero)
Else
IfisPNG(fichero)Then
ReadImg=ReadPNG(fichero)
Else
IfisBMP(fichero)Then
ReadImg=ReadPNG(fichero)
Else
IfisWMF(fichero)Then
ReadImg=ReadWMF(fichero)
Else
ReadImg=Array(0,0)
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunction
FunctionReadJPG(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile(Server.MapPath("/"&fichero),1)
s=Right(ts.Read(167),4)
HW(0)=HexToDec(HexAt(s,3)&HexAt(s,4))
HW(1)=HexToDec(HexAt(s,1)&HexAt(s,2))
ts.Close
ReadJPG=HW
EndFunction
FunctionReadPNG(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile(Server.MapPath("/"&fichero),1)
s=Right(ts.Read(24),8)
HW(0)=HexToDec(HexAt(s,3)&HexAt(s,4))
HW(1)=HexToDec(HexAt(s,7)&HexAt(s,8))
ts.Close
ReadPNG=HW
EndFunction
FunctionReadGIF(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile(Server.MapPath("/"&fichero),1)
s=Right(ts.Read(10),4)
HW(0)=HexToDec(HexAt(s,2)&HexAt(s,1))
HW(1)=HexToDec(HexAt(s,4)&HexAt(s,3))
ts.Close
ReadGIF=HW
EndFunction
FunctionReadWMF(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile(Server.MapPath("/"&fichero),1)
s=Right(ts.Read(14),4)
HW(0)=HexToDec(HexAt(s,2)&HexAt(s,1))
HW(1)=HexToDec(HexAt(s,4)&HexAt(s,3))
ts.Close
ReadWMF=HW
EndFunction
FunctionReadBMP(fichero)
Dimfso,ts,s,HW,nbytes
HW=Array("","")
Setfso=CreateObject("Scripting.FileSystemObject")
Setts=fso.OpenTextFile(Server.MapPath("/"&fichero),1)
s=Right(ts.Read(24),8)
HW(0)=HexToDec(HexAt(s,4)&HexAt(s,3))
HW(1)=HexToDec(HexAt(s,8)&HexAt(s,7))
ts.Close
ReadBMP=HW
EndFunction
FunctionisDigit(c)
IfinStr("0123456789",c)<>0Then
isDigit=true
Else
isDigit=false
EndIf
EndFunction
FunctionisHex(c)
IfinStr("0123456789ABCDEFabcdef",c)<>0Then
isHex=true
Else
ishex=false
EndIf
EndFunction
FunctionHexToDec(cadhex)
Dimn,i,ch,decimal
decimal=0
n=Len(cadhex)
Fori=1Ton
ch=Mid(cadhex,i,1)
IfisHex(ch)Then
decimal=decimal*16
IfisDigit(c)Then
decimal=decimal+ch
Else
decimal=decimal+Asc(uCase(ch))-Asc("A")
EndIf
Else
HexToDec=-1
EndIf
Next
HexToDec=decimal
EndFunction
%>
相关文章
- 17. 基础IO(1)——文件操作类
- 如何使用IPGeo从捕捉的网络流量文件中快速提取IP地址
- 【C 语言】文件操作 ( C 语言中的文件操作函数 | 磁盘与内存缓冲区 | 缓冲区工作机制 )
- 【C 语言】文件操作 ( remove 函数删除文件 | rename 函数重命名文件 | 代码示例 )
- 【Unity3D】资源文件 ① ( Unity 中常用的文件类型 | Unity 文件操作 | 文件系统中查看文件 | 添加文件 | 删除文件 | 导入文件 | 复制文件 | 缩略图显示 )
- java文件操作类(新建 复制 移动 删除文件和文件夹 获取扩展名)详解编程语言
- Linux复制本地文件的简单操作(linux复制本地文件)
- 追溯Linux文件操作的历史变化(linux文件操作历史)
- 夹Linux下删除文件夹中所有文件的操作(linux清空文件)
- 查看Linux文件日期:使用LS命令(linuxls日期)
- Linux命令中的JAR文件操作(jarlinux命令)
- Linux命令大全:轻松掌握文件操作技巧与记录方法(linux记录文件操作)
- Linux操作系统中运用sed命令对文件的简单编辑操作(linuxsed文件)
- 如何在Linux中访问文件(linux怎么访问文件)
- Linux文件“闪烁”危机:教你识别轻微损坏文件(linux文件闪烁)
- Oracle操作MDF文件一步一步深入学习(MDF文件oracle)
- PHP中的MySQL文件上传函数分享(mysql上传文件函数)
- asp动态include文件,方便多模板的实现
- 《PHP编程最快明白》第五讲:php目录、文件操作
- PHP图片文件上传实现代码
- PHP删除文件与文件夹操作unlink()与rmdir()这两个函数的使用
- C#对文件与文件夹的操作包括删除、移动与复制
- javascript系统文件夹文件操作及参数介绍
- PHP常用技术文之文件操作和目录操作总结