| PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >> |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
|
#1 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Aug 2004
6 posts
Gave thanks: 0
Thanked 0 times
|
Cannot create folder
I tried creating a folder but it doesn't seem to work. It creates a file but not a directory. Can u help me please?
--------- function checkDir($dir) if (!is_dir($dir)) mkdir($dir, 777); if (is_dir($dir)) $d = opendir($dir); } sample ->>>> checkDir("pics/104") See the attached for what I'm saying. It's the last file - 104 (suppose to be a folder). Do you have an idea why it's creating that file instead of a folder? I really need this please. ------------------ |
|
|
|
|
|
#2 (permalink) |
|
Surpass Fan
Super #1
Joined in Aug 2004
Hosted on SH58
1,688 posts
Gave thanks: 6
Thanked 7 times
|
The parent folder needs to be chmodded to 0777 before child folders may be created.
EDIT: Upon closer investigation, it appears you need to seperate your folder path from your directory name. Like so: function checkDir($dir) $array = explode( "/", $dir ); if (!is_dir($array[0])) mkdir($array[0], 777); if (is_dir($array[0])) $d = opendir($array[0]); } And that should work for you.
__________________
- Evan Charlton | [site] | Server - SH58 Last edited by Kickersny.com; December 23rd, 2004 at 2:05 PM.. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Aug 2004
6 posts
Gave thanks: 0
Thanked 0 times
|
The function worked on my computer but it won't work on my server. It created a binary file instead of a real folder on the server. Do you think you know what the problem is?
- - - - code - - - if (!is_dir($dir)) [at]mkdir("$dir", 0777); $d = opendir($dir); |
|
|
|