473,773 Members | 2,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mkdir sucks, really

OK, I do this call on a linux system:

if(!file_exists ("../pages/".$_POST['ParentName']."/"))
{
$dirname = "/home/u2/sss/sss/html/pages/".$_POST['ParentName']."";
mkdir($dirname, $mode);

}

and get this:

Warning: mkdir() [function.mkdir]: File exists in /home/u2/mypage.php
on line 19

When it clearly doesn't exist! I looked!

HELP!

Jun 1 '07 #1
3 3028
rf

"Cris" <ba************ @gmail.comwrote in message
news:11******** **************@ o11g2000prd.goo glegroups.com.. .
OK, I do this call on a linux system:

if(!file_exists ("../pages/".$_POST['ParentName']."/"))
{
$dirname = "/home/u2/sss/sss/html/pages/".$_POST['ParentName']."";
mkdir($dirname, $mode);

}

and get this:

Warning: mkdir() [function.mkdir]: File exists in /home/u2/mypage.php
on line 19

When it clearly doesn't exist! I looked!
Do ../pages/ and /home/u2/sss/sss/html/pages/ resolve to exactly the same
place?

--
Richard.
Jun 1 '07 #2
At Fri, 01 Jun 2007 04:20:18 +0000, Cris let h(is|er) monkeys type:
OK, I do this call on a linux system:

if(!file_exists ("../pages/".$_POST['ParentName']."/"))
{
$dirname = "/home/u2/sss/sss/html/pages/".$_POST['ParentName']."";
mkdir($dirname, $mode);

}

and get this:

Warning: mkdir() [function.mkdir]: File exists in /home/u2/mypage.php
on line 19

When it clearly doesn't exist! I looked!

HELP!
What does $_POST['Parentname'] contain ? Echo it's value to check.
The warning would make sense if it's empty. And get rid of the '/' in the
file_exists line. At best it doesn't make a difference.

Why use a relative path first, followed by an absolute path?

mkdir doesn't suck, really. It creates a directory or returns false and
throws a warning if that process fails.

--
Schraalhans Keukenmeester - sc*********@the .Spamtrapexampl e.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples ','oranges') < 0"

Jun 1 '07 #3
On May 31, 11:56 pm, Schraalhans Keukenmeester
<Schraalh...@th e.spamtrapexamp le.nlwrote:
At Fri, 01 Jun 2007 04:20:18 +0000, Cris let h(is|er) monkeys type:
OK, I do this call on a linux system:
if(!file_exists ("../pages/".$_POST['ParentName']."/"))
{
$dirname = "/home/u2/sss/sss/html/pages/".$_POST['ParentName']."";
mkdir($dirname, $mode);
}
and get this:
Warning: mkdir() [function.mkdir]: File exists in /home/u2/mypage.php
on line 19
When it clearly doesn't exist! I looked!
HELP!

What does $_POST['Parentname'] contain ? Echo it's value to check.
The warning would make sense if it's empty. And get rid of the '/' in the
file_exists line. At best it doesn't make a difference.

Why use a relative path first, followed by an absolute path?

mkdir doesn't suck, really. It creates a directory or returns false and
throws a warning if that process fails.

--
Schraalhans Keukenmeester - schraalh...@the .Spamtrapexampl e.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples ','oranges') < 0"
Yes, I guess my monkeys were typing my code indeed.
They did resolve to the same place, BUT, Schraalhans was right.
$_POST['ParentName'] should have been $_POST['fileName'].
I got the two switched on the previous page. :O I feel sheepish.

I went through all the stuff at php.net and couldn't figure it out.
BTW I changed them both to absolute paths.

Thanks for your help.

Jun 2 '07 #4

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

Similar topics

2
1755
by: Shaun | last post by:
Hello! I can't seem to get paths and variables working together: import os a = 'books' os.chdir( '/test') os.mkdir("/test/"a) the last line does not seem to work. os.mkdir(a) makes the directory
16
2232
by: zwetan | last post by:
Hi, often I see people telling that "javascript sucks" - is it because of the DOM with JS ? - is it because of the language in itself ? - is it because browsers/hosts differences ? - is it because of language limitation ? etc. please don't turn this into a flame/troll war,
7
3215
by: DataSmash | last post by:
Hello, I think I've tried everything now and can't figure out how to do it. I want to read in a text list from the current directory, and for each line in the list, make a system directory for that name. My text file would look something like this: 1144 1145 1146 1147
8
6061
by: Sue | last post by:
AccessXP in Access2000 Mode: In my code I use the MkDir method to create a folder and then I want to use the transfertext method to create a delimited text file in that folder. MkDir runs and then when transfertext runs I get a message that a file can not be created in the folder because the folder is Read Only. When I check the folder's attributes with Windows Explorer, sure enough the folder is Read Only. How can I use the MkDir...
5
9275
by: eoindeb | last post by:
I am trying to create a directory on Solaris using the mkdir() function. This works fine when I pass a string literal ("/etc/hosts") to mkdir, but if I try passing a directory pointer to mkdir, it returns a -1 error. The directory error works fine with fopen - does anyone know what I am doing wrong?? Here's a snippet of the code: int Check_Directory() //check for existence of directory - if not there, create the file { int status, ret...
30
7710
by: MikeC | last post by:
Good People, I'm writing a backup utility that uses a chdir() to go into the source directory (in which the files reside that I want to back up), so I don't want to use chdir() to get into the target directory (where the backup copies will be kept, on another drive). I can successfully test whether the target directory exists or not using findfirst(), but if it doesn't, I wanted to create it using mkdir(), but it doesn't like the path...
8
24530
by: vj | last post by:
How do I do the following unix command: mkdir -m770 test with the os.mkdir command. Using os.mkdir(mode=0770) ends with the incorrect permissions. Thanks, VJ
4
5423
by: John | last post by:
Hi The following does not create a directory neither does it give any error message. Any ideas? $umask=umask(0); $where="/var/www/vhosts/example.com/httpdocs/friday/"; mkdir ($where,0777); umask($umask);
2
1993
by: _q_u_a_m_i_s's | last post by:
Hy, i encountered a weird problem on a server running php5, and apache. Seems like i cannot create folders that end with "/". for example: mkdir("test/") will fail mkdir("test") will work Is there any issue with mkdir that i don`t know about? or safe_mode affects this in any way? The problem is that mkdir is called in lots of different places in the
0
10264
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
10106
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...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
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...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
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
3610
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.