Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create folder and file in it.

Status
Not open for further replies.

JamieFuller

Programmer
May 2, 2001
20
GB
Hi,

I have a php script that creates a folder, this works but the permissions are incorrect.
I have tried using the chmod command with setting 0777 but that only changes it to 757 (or something like that)

I want to create a folder and then cretae a small php file inside it.

is 0777 the right access level or is that too open?

my idea is

Code:
mkdir ("folder",0777);
$filea = fopen ("folder.index.php","w");
fwrite($filea,"test text");
fclose ($filea);


is that ok? will it work?



Kindest Regards
Jamie
 
Yeah, should do. Except for your mistake on;

$filea = fopen ("folder.index.php","w");

Note that you have folder.index.php, and not folder/index.php

Cheers

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top