A few questions on files and folders

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ruski
Forum Commoner
Posts: 28
Joined: Thu May 26, 2005 3:45 am

A few questions on files and folders

Post by Ruski »

hi,

I was just searching on the web how to do these things but couldnt find anything :( hope someone helps.
I wanted to know how to:

- Delete a folder
- Set permission so I am able to create new folders
- Renaming folders
- Creating new files(like on a cPanel)

and I think thats about it :D

Thanks in advance
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Delete a folder:

rmdir()

Set permissions:

chmod()

Rename folder:

rename()

New files:

fopen() <-- use w+

:)
Ruski
Forum Commoner
Posts: 28
Joined: Thu May 26, 2005 3:45 am

Post by Ruski »

Thank you very much, very helpfull :)
Ruski
Forum Commoner
Posts: 28
Joined: Thu May 26, 2005 3:45 am

Post by Ruski »

Another question

when i tryed to create a new directory it came up with a permission erro:

Warning: mkdir(/home/ruski/public_html/hello): Permission denied in /home/ruski/public_html/create.php on line 3

Which permission is that?
rochakchauhan
Forum Newbie
Posts: 5
Joined: Tue Apr 26, 2005 4:32 am

well....

Post by rochakchauhan »

If you are on unix system, make sure that you have write permission to directory where you are trying to create this directory.
and the Code is :

Code: Select all

mkdir("dirName", 0777); // this will give all rights to the new folder
Ruski
Forum Commoner
Posts: 28
Joined: Thu May 26, 2005 3:45 am

Post by Ruski »

<?php

mkdir("/home/ruski/public_html/host/hello",777);

?>

That is what ive got and I still get the permission error, ive the set the directory permissions to where I want to create a new folder to 777 and still the same.

Thanks
Ruski
Forum Commoner
Posts: 28
Joined: Thu May 26, 2005 3:45 am

Post by Ruski »

Never mind i got it working :D

I had to set the php file permission to 777 the one that I was running to make the new directory.

Thanks for all the help
Post Reply