Problem using COM, specifically the FileScriptingObject

From: Date: Thu, 15 Aug 2002 01:13:34 +0000
Subject: Problem using COM, specifically the FileScriptingObject
Groups: php.windows 
Request: Send a blank email to php-windows+get-15270@lists.php.net to get a copy of this message
I have included my code below. This is my first experience trying to use COM objects in PHP. My problem is that the foreach loop does not output anything, regardless of whether or not there are files in the folder. Can anyone tell me what is wrong with my script? Thanks for any help. Kyle <?php session_start(); $objPath = "C:\\" . $_SESSION['user'] . "\\"; print $objPath; $objFileManager = new COM("Scripting.FileSystemObject") or die("cant open COM object"); if ($objFileManager->FolderExists($objPath)) { print "folder exists"; $objFolder = $objFileManager->GetFolder($objPath); $objFolder->Path; $fileCollection = $objFolder->Files; foreach ( $fileCollection as $file ){ print $file->Path; } } else print "doesnt exist"; ?>

« previous php.windows (#15270) next »