stat(), file_exists(), is_file() on Windows2000

From: Date: Thu, 30 Oct 2003 21:03:53 +0000
Subject: stat(), file_exists(), is_file() on Windows2000
Groups: php.general 
Request: Send a blank email to php-general+get-168182@lists.php.net to get a copy of this message
All, Here's a new one from me. Had to move a project from a friendly linux environment to an unfriendly windows environment. The problem: all the code I've tried to test whether a temp (from a form post) is there before doing a filesize() on it is failing. I'm doing a filesize check so absurdly large files aren't copied from the temp folder to a permanent folder. (and no I can't change the ini file, already asked, I did mention unfriendly right?) What I want is a value for the filesize of the temporary file. After a form post I call a function with the following: $image_size = getFileSize($_FILES["image"]["tmp_name"]); The value of $_FILES["image"]["tmp_name"] is something like: C:\WINNT\TEMP\php41.tmp here's the function I'm using: function getFileSize($a) { // if (is_file($a)) if (file_exists($a)) { $tmp = number_format(filesize($a)/1024) ." KB"; }else{ $tmp = "error"; } clearstatcache(); return $tmp; } The root of the web server is on the G drive, so I don't know if files on the C drive are considered "remote" or not. I've tried changing the C:\WINNT\TEMP\php41.tmp to C:/WINNT/TEMP/php41.tmp and C:\\WINNT\\TEMP\\php41.tmp, that didn't work. I've tried stat($a); at the start of the function but get an error: Warning: stat failed for C:\WINNT\TEMP\php41.tmp (errno=2 - No such file or directory) in G:\web\domain.com\d\g\functions\fn_data.php on line 41 Right now the function returns "error". I've searched the MARC archives, I've searched Google, I've read the manual and contributed notes. Any suggestions? Thanks in advance Chris Hubbard chris@wildcharacters.com www.wildcharacters.com 425 481 2020 php based web application development Y! hoponpopontoponmoponcop@yahoo.com MSN another_ganesha@hotmail.com AIM ganeshacph

« previous php.general (#168182) next »