asp判断文件类型代码<br /> 语法<br /> FileObject.Type <br /> FolderObject.Type <br /> <br /> 实例File对象<br /> &lt;%<br /> dim fs,f<br /> set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)<br /> set f=fs.GetFile(&quot;c:test.txt&quot;)<br /> Response.Write(&quot;The file test.txt is of type: &quot;)<br /> Response.Write(f.Type)<br /> set f=nothing<br /> set fs=nothing<br /> %&gt;<br /> Output:<br /> The file test.txt is of type: Text Document<br /> <br /> 同样fso type还可以判断文件夹<br /> &lt;%<br /> dim fs,fo<br /> set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)<br /> set fo=fs.GetFolder(&quot;c:test&quot;)<br /> Response.Write(&quot;The folder test is of type: &quot;)<br /> Response.Write(fo.Type)<br /> set fo=nothing<br /> set fs=nothing<br /> %&gt;<br /> Output:The folder test is of type: File Folder<br />
返回顶部 留言