<p>如何使用ASP文件对象<br /> 在下面的例子中,我们创建一个FileSystemObject对象的实例,然后使用GetFile方法实例化File对象。之后,我们使用的文件对象属性以获取有关指定文件的信息:<br /> &lt;%<br /> Dim objFSO, objDrive<br /> &#39;Create a FileSystemObject instance<br /> Set objFSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)<br /> &#39;Using the GetFile method of FileSystemObject object, initialize a File object<br /> Set objFile = objFSO.GetFile(&quot;c:test.txt&quot;)<br /> &#39;Retrieve information about the file<br /> Response.Write &quot;Name: &quot; &amp; objFile.Name &amp; &quot;&lt;br /&gt;&quot;<br /> Response.Write &quot;ShortName: &quot; &amp; objFile.ShortName &amp; &quot;&lt;br /&gt;&quot;<br /> Response.Write &quot;Size: &quot; &amp; objFile.Size &amp; &quot; bytes &lt;br /&gt;&quot;<br /> Response.Write &quot;Type: &quot; &amp; objFile.Type &amp; &quot;&lt;br /&gt;&quot;<br /> Response.Write &quot;Path: &quot; &amp; objFile.Path &amp; &quot;&lt;br /&gt;&quot;<br /> Response.Write &quot;ShortPath: &quot; &amp; objFile.ShortPath &amp; &quot;&lt;br /&gt;&quot;<br /> Response.Write &quot;Created: &quot; &amp; objFile.DateCreated &amp; &quot;&lt;br /&gt;&quot;<br /> Response.Write &quot;LastModified: &quot; &amp; objFile.DateLastModified &amp; &quot;&lt;br /&gt;&lt;br /&gt;&quot;<br /> %&gt;</p>
T:0.006965s,M:245.52 KB
返回顶部 留言