Hello,
I'm having some slight issues. I have a script which creates a directory and then
copies a blank file into it 4 times each with different names. Here's the code which
does it:
<?php
$folder = str_replace(' ', '_', $HTTP_POST_VARS['title']);
$folder = str_replace('.', '', $folder);
mkdir('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder, 0777);
copy('./tutorials/blank.txt',
'./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/desc.txt');
copy('./tutorials/blank.txt',
'./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/rating.txt');
copy('./tutorials/blank.txt',
'./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/overview.txt');
copy('./tutorials/blank.txt',
'./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/views.txt');
chmod('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/desc.txt', 0777);
chmod('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/rating.txt', 0777);
chmod('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/overview.txt', 0777);
chmod('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/views.txt', 0777);
$fp = fopen('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/desc.txt',
'w+');
fwrite($fp, $HTTP_POST_VARS['desc']);
$fp = fopen('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/overview.txt',
'w+');
fwrite($fp, $HTTP_POST_VARS['overview']);
$fp = fopen('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/views.txt',
'w+');
fwrite($fp, '0');
$fp = fopen('./tutorials/'.$HTTP_POST_VARS['folder'].'/'.$folder.'/rating.txt',
'w+');
fwrite($fp, '0');
?>
After all that is done, it's fine. The problem I'm having is deleting the folder in an
FTP client. Whenever I go to delete it, it says it cannot delete desc.txt because
permission is denied. Is there any way to make it so it can be deleted? Please help
and reply soon. Thanks!
Thank you,
Stephen Craton
Senior Executive Web Developer
Mophus.com, Inc.
Lead Programmer/Webmaster
WiredPHP (http://php.melchior.us)