473,811 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is_dir() issue.

Hello.

I have a minor issue with is_dir(). When running two almost identical
scripts from two different directories with same target directory I get
different output. The only difference between the scripts is a variable
containing the path to the target directory.

The scripts are located here:

http://ionline.dk/test/test1.php
http://ionline.dk/test/files/test2.php

Contents of the scripts:

http://ionline.dk/test/test1.php:

<html>
<head>
<title></title>
</head>
<body>
<?php
$dir = getcwd() . '/files' ;
echo '<h1>Listing content of ' . $dir . '</h1>' . "\n";
echo '<table><tr><td >file</td><td>is_dir() </td></tr>' . "\n";
$dir = dir($dir);
while(false !== ($entry = $dir->read())){
if($entry != 'index.php')
echo '<tr><td>' . $entry . '</td><td>' . is_dir($entry) .
'</td></tr>' . "\n";
}
$dir->close();
echo '</table>'
?>
</body>
</html>
http://ionline.dk/test/test1.php:

<html>
<head>
<title></title>
</head>
<body>
<?php
$dir = getcwd();
echo '<h1>Listing content of ' . $dir . '</h1>' . "\n";
echo '<table><tr><td >file</td><td>is_dir() </td></tr>' . "\n";
$dir = dir($dir);
while(false !== ($entry = $dir->read())){
if($entry != 'index.php')
echo '<tr><td>' . $entry . '</td><td>' . is_dir($entry) .
'</td></tr>' . "\n";
}
$dir->close();
echo '</table>'
?>
</body>
</html>

Any suggestions on what is causing this is appreciated.

Regards.
Oct 1 '08 #1
1 2411
Nevermind this one. Apparently I was looking for the files in the wrong
directory. Guess it's caused by lack of fresh air. Here's the proper
content of test1.php :

<html>
<head>
<title></title>
</head>
<body>
<?php
$dir = getcwd() . '/files' ;
echo '<h1>Listing content of ' . $dir . '</h1>' . "\n";
echo '<table><tr><td >file</td><td>is_dir() </td></tr>' . "\n";
$dir = dir($dir);
while(false !== ($entry = $dir->read())){
if($entry != 'index.php')
echo '<tr><td>' . $entry . '</td><td>' .
is_dir('files/'.$entry) . '</td></tr>' . "\n";
}
$dir->close();
echo '</table>'
?>
</body>
</html>
Regards
Oct 1 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4950
by: bart | last post by:
i run 4.3.4 but is_dir doesn't work always. when i put a counter in a readdir loop, it returns the number 5 that is; .. ...
4
3818
by: lawrence | last post by:
In the function below, before I open the directory I first test to make sure the address I have is, in fact, a directory. This function was working fine on one web server running FreeBSD and PHP 4.06. However, today I'm trying to run this software on a new server (RH Linux 9, PHP 4.2.3) and the directory is failing the is_dir() test. The error message that I have in my code is printing out this error: In getListOfAnyDirectory(), we...
5
2721
by: ravenslay3r | last post by:
I'm using a script to grab images from a directory and put them to the screen, but i want it to ignore sub-directories like CVS/ . Adding the tag "&& !is_dir($file)" to the correct conditional statement solved it on my test server, but not on the actual site. How is this possible? How can I fix it? thanks,
7
3304
by: George Hester | last post by:
Please take a look at this google artcle: http://groups.google.com/groups?hl=en&lr=&frame=right&th=55d6f4b50f5f9382&seekm=411f370d%241%40olaf.komtel.net#link9 The op was having trouble with access denied using resizeTo. I am having the same issue but the explanations in this article don't seem to apply here. I am not trying to resize a window with content from a different server. This issue lies here. What I do is make a popup...
2
2470
by: Anthony Cuttitta Jr. | last post by:
We have an application that outputs several different graphs from data downloaded from our AS400. The application has worked without (this) issue for several months now, but just recently, the workstation it is normally run from has been upgraded to WinXP from WinNT 5.0. The issue is that the graphs will either display the data within the recordsource (a query), OR it will display the "temp" data in the chart's datasheet (from initial...
2
2826
by: Ben Rush | last post by:
Hello World, Okay, I have spent the day browsing the newsgroups and reading up on article after article concerning ViewState corruption and so forth, and I have a couple questions. We intermittantly get the following exception - EXCEPTION MESSAGE: The viewstate is invalid for this page and might be corrupted. STACK TRACE:
2
2586
by: Juby | last post by:
I'm creating a script for our website which will function as something of a docment manager. The backend features an option to create a new directory in the uploads subdirectory. The problem is, once I've used mkdir() to create this file, when I later run is_dir() on the filename, I get 'false'. Even worse, if I run is_file() on the new directories, I get false as well. The same thing seems to be happening to files I submit via the...
12
2338
by: comp.lang.php | last post by:
Env: Windows XP, Apache 1.33, PHP 5.2.0 <? echo is_dir($_SERVER) . " for dir = " . $_SERVER); ?>
13
3522
by: SAL | last post by:
Hello, I'm trying to include a popup in the ItemTemplate of a gridview row. The ItemTemplate for the field contains a textbox and when the user clicks in the textbox I want a popup panel to show allowing the user to make a selection from the popup window. I have enabled AJAX extensions and have a working sample outside of a gridview. However, when I click in the textbox of a gridview row, all I see is a really small square instead of the...
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10135
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.