Pure-Essence.Net

OMG geeky bday gift

Posted by: pureessence on: January 27, 2005

ok i got my best geeky birthday gift today. LOL, you will have to be a geek to understand my excitement right now. hehehehe i’m soooooooooo happy.

you know how when you use opendir and readdir, you have to chmod your folder to 755 or 777 first? and how if you use mkdir, you won’t be able to delete the directory you created in ftp? it’s such a hassle. i just learned today that you don’t have to. OMG!! i wish i knew this sooner. the trick is to use umask.

if you want to try, just create a directory called test on your domain root, and put a testing file in it. i just put a random jpg. then paste the following code:

<? 
	$old = umask(0); 
	if($dh = opendir($_SERVER[DOCUMENT_ROOT]."/test")) { 
		while (($file = readdir($dh)) !== false) { 
			echo $file."<br />\n"; 
		} 
	} umask($old); 
?>

to a text file and name it “test.php”. upload it to your domain and run it. you should see something like:

.
..
yourtestingfilename

it worked for me. so no chmod. OMG i’m so happy, now i don’t have to chmod all the folders i upload in my gallery folder. muahahahaha!!!!

on the other hand, if you were to create a dir with mkdir. use the code below:

$u = umask(0); 
mkdir($path_to_ur_dir, 0777); 
umask($u);

that way you can easily delete the folder you created with ftp.

Advertisement

3 Responses to "OMG geeky bday gift"

That trick looks really cool. Although I’ve never encountered that problem before.

hehehe…. lol… i remember when i don’t even know how to chmod… lol… know how you feel.

woohoo! Thanks for sharing sis. :) Happy birthday again my geeky sis. hehehe

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

My most adorable Pomeranians

Categories

Archives

SocialVibe


Follow

Get every new post delivered to your Inbox.