0
OT: Create a folder using PHP?
LEGEND
,
/t5/dreamweaver-discussions/ot-create-a-folder-using-php/td-p/1051584
Sep 04, 2006
Sep 04, 2006
Copy link to clipboard
Copied
I'm trying to create a folder in PHP, and I'm using this
markup -
<?php
$dir = 'test';
echo(!mkdir('/images/'.$dir)?'Fail':'Success');
?>
Shouldn't that work (I'm hosted on Windows, but it's PHP5)?
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
<?php
$dir = 'test';
echo(!mkdir('/images/'.$dir)?'Fail':'Success');
?>
Shouldn't that work (I'm hosted on Windows, but it's PHP5)?
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
TOPICS
Server side applications
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/dreamweaver-discussions/ot-create-a-folder-using-php/m-p/1051585#M187630
Sep 04, 2006
Sep 04, 2006
Copy link to clipboard
Copied
On 04 Sep 2006 in macromedia.dreamweaver.appdev, Murray *ACE*
wrote:
> I'm trying to create a folder in PHP, and I'm using this markup -
>
> <?php
> $dir = 'test';
> echo(!mkdir('/images/'.$dir)?'Fail':'Success');
> ?>
>
> Shouldn't that work (I'm hosted on Windows, but it's PHP5)?
How 'bout this?
http://www.php.net/manual/en/function.mkdir.php
--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
> I'm trying to create a folder in PHP, and I'm using this markup -
>
> <?php
> $dir = 'test';
> echo(!mkdir('/images/'.$dir)?'Fail':'Success');
> ?>
>
> Shouldn't that work (I'm hosted on Windows, but it's PHP5)?
How 'bout this?
http://www.php.net/manual/en/function.mkdir.php
--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/dreamweaver-discussions/ot-create-a-folder-using-php/m-p/1051586#M187631
Sep 04, 2006
Sep 04, 2006
Copy link to clipboard
Copied
Exactly the page I was using.
When I try the code I posted, I get this -
Warning: mkdir() [function.mkdir]: No such file or directory in
W:\Webspace\resadmin\madison\madisonconcrete.com\www\x-mkdir.php on line 11
Fail
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns9834645C959D4makowiecatnycapdotrE@216.104.212.96...
> On 04 Sep 2006 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:
>
>> I'm trying to create a folder in PHP, and I'm using this markup -
>>
>> <?php
>> $dir = 'test';
>> echo(!mkdir('/images/'.$dir)?'Fail':'Success');
>> ?>
>>
>> Shouldn't that work (I'm hosted on Windows, but it's PHP5)?
>
> How 'bout this?
>
> http://www.php.net/manual/en/function.mkdir.php
>
> --
> Joe Makowiec
> http://makowiec.net/
> Email: http://makowiec.net/email.php
When I try the code I posted, I get this -
Warning: mkdir() [function.mkdir]: No such file or directory in
W:\Webspace\resadmin\madison\madisonconcrete.com\www\x-mkdir.php on line 11
Fail
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns9834645C959D4makowiecatnycapdotrE@216.104.212.96...
> On 04 Sep 2006 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:
>
>> I'm trying to create a folder in PHP, and I'm using this markup -
>>
>> <?php
>> $dir = 'test';
>> echo(!mkdir('/images/'.$dir)?'Fail':'Success');
>> ?>
>>
>> Shouldn't that work (I'm hosted on Windows, but it's PHP5)?
>
> How 'bout this?
>
> http://www.php.net/manual/en/function.mkdir.php
>
> --
> Joe Makowiec
> http://makowiec.net/
> Email: http://makowiec.net/email.php
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/dreamweaver-discussions/ot-create-a-folder-using-php/m-p/1051588#M187635
Sep 04, 2006
Sep 04, 2006
Copy link to clipboard
Copied
you need to make the directory structure one level at a time.
so make the images directory, then make your test directory. once
the images folder is created your code should work, just remove the
first forward slash (before images). this works on my wamp server.
also check out this comment on the php.net page:
also check out this comment on the php.net page:
quote:
cost me an hour to get recursive switch to work in windows with php 5.2.0, so share it here. The key is backward slash in windows , this php version doesn't recognize forward slash as valid path separator for mkdir(), though other functions support forward-slashed paths just fine. The following example works in Windows:
<?php
$mypath="testdir\subdir\test";
mkdir($mypath,0777,TRUE);
?>
This doesn't work in windows:
<?php
$mypath="testdir/subdir/test";
mkdir($mypath,0777,TRUE);
?>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/dreamweaver-discussions/ot-create-a-folder-using-php/m-p/1051589#M187637
Sep 04, 2006
Sep 04, 2006
Copy link to clipboard
Copied
The images directory is already there.
> cost me an hour to get recursive switch to work in windows with php 5.2.0,
> so
> share it here. The key is backward slash in windows , this php version
> doesn't
> recognize forward slash as valid path separator for mkdir(), though other
> functions support forward-slashed paths just fine. The following example
> works
> in Windows:
> <?php
> $mypath="testdir\subdir\test";
> mkdir($mypath,0777,TRUE);
> ?>
> This doesn't work in windows:
> <?php
> $mypath="testdir/subdir/test";
> mkdir($mypath,0777,TRUE);
> ?>
>
This is likely the answer. I'll try it.
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"digitalus media" <webforumsuser@macromedia.com> wrote in message
news:edhej7$rfo$1@forums.macromedia.com...
> you need to make the directory structure one level at a time. so make the
> images directory, then make your test directory. once the images folder is
> created your code should work, just remove the first forward slash (before
> images). this works on my wamp server.
>
> also check out this comment on the php.net page:
>
>
>
> cost me an hour to get recursive switch to work in windows with php 5.2.0,
> so
> share it here. The key is backward slash in windows , this php version
> doesn't
> recognize forward slash as valid path separator for mkdir(), though other
> functions support forward-slashed paths just fine. The following example
> works
> in Windows:
> <?php
> $mypath="testdir\subdir\test";
> mkdir($mypath,0777,TRUE);
> ?>
> This doesn't work in windows:
> <?php
> $mypath="testdir/subdir/test";
> mkdir($mypath,0777,TRUE);
> ?>
>
This is likely the answer. I'll try it.
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"digitalus media" <webforumsuser@macromedia.com> wrote in message
news:edhej7$rfo$1@forums.macromedia.com...
> you need to make the directory structure one level at a time. so make the
> images directory, then make your test directory. once the images folder is
> created your code should work, just remove the first forward slash (before
> images). this works on my wamp server.
>
> also check out this comment on the php.net page:
>
>
quote:
> cost me an hour to get recursive switch to work in windows with php 5.2.0,
> so
> share it here. The key is backward slash in windows , this php version
> doesn't
> recognize forward slash as valid path separator for mkdir(), though other
> functions support forward-slashed paths just fine. The following example
> works
> in Windows:
> <?php
> $mypath="testdir\subdir\test";
> mkdir($mypath,0777,TRUE);
> ?>
> This doesn't work in windows:
> <?php
> $mypath="testdir/subdir/test";
> mkdir($mypath,0777,TRUE);
> ?>
>
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
LATEST
/t5/dreamweaver-discussions/ot-create-a-folder-using-php/m-p/1051590#M187639
Sep 04, 2006
Sep 04, 2006
Copy link to clipboard
Copied
OK - this code works -
<?php
$dir = '\test';
if(!is_dir('images'.$dir)) {
mkdir('images'.$dir);
}
if(is_dir('images'.$dir)) {
echo"Success";
} else {
echo"FAIL";
}
?>
Thanks guys....
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"digitalus media" <webforumsuser@macromedia.com> wrote in message
news:edhej7$rfo$1@forums.macromedia.com...
> you need to make the directory structure one level at a time. so make the
> images directory, then make your test directory. once the images folder is
> created your code should work, just remove the first forward slash (before
> images). this works on my wamp server.
>
> also check out this comment on the php.net page:
>
>
>
<?php
$dir = '\test';
if(!is_dir('images'.$dir)) {
mkdir('images'.$dir);
}
if(is_dir('images'.$dir)) {
echo"Success";
} else {
echo"FAIL";
}
?>
Thanks guys....
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"digitalus media" <webforumsuser@macromedia.com> wrote in message
news:edhej7$rfo$1@forums.macromedia.com...
> you need to make the directory structure one level at a time. so make the
> images directory, then make your test directory. once the images folder is
> created your code should work, just remove the first forward slash (before
> images). this works on my wamp server.
>
> also check out this comment on the php.net page:
>
>
quote:
> cost me an hour to get recursive switch to work in windows with php 5.2.0,
> so
> share it here. The key is backward slash in windows , this php version
> doesn't
> recognize forward slash as valid path separator for mkdir(), though other
> functions support forward-slashed paths just fine. The following example
> works
> in Windows:
> <?php
> $mypath="testdir\subdir\test";
> mkdir($mypath,0777,TRUE);
> ?>
> This doesn't work in windows:
> <?php
> $mypath="testdir/subdir/test";
> mkdir($mypath,0777,TRUE);
> ?>
>
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/dreamweaver-discussions/ot-create-a-folder-using-php/m-p/1051587#M187633
Sep 04, 2006
Sep 04, 2006
Copy link to clipboard
Copied
On 04 Sep 2006 in macromedia.dreamweaver.appdev, Murray *ACE*
wrote:
> Exactly the page I was using.
>
> When I try the code I posted, I get this -
>
> Warning: mkdir() [function.mkdir]: No such file or directory in
> W:\Webspace\resadmin\madison\madisonconcrete.com\www\x-mkdir.php on
> line 11
echo(!mkdir('/images/'.$dir)?'Fail':'Success');
- The notes indicate that you may need to use backslashes on a W*ndows
server.
- Do you need to use the full path? You're specifying from the root. Or
you may want to try with a relative path.
- What happens if you do just the bare function, without putting it
inside the echo and ternary operator?
--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
> Exactly the page I was using.
>
> When I try the code I posted, I get this -
>
> Warning: mkdir() [function.mkdir]: No such file or directory in
> W:\Webspace\resadmin\madison\madisonconcrete.com\www\x-mkdir.php on
> line 11
echo(!mkdir('/images/'.$dir)?'Fail':'Success');
- The notes indicate that you may need to use backslashes on a W*ndows
server.
- Do you need to use the full path? You're specifying from the root. Or
you may want to try with a relative path.
- What happens if you do just the bare function, without putting it
inside the echo and ternary operator?
--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

