Jump to content

creating a FILE in a created folder problem???


rajmohan

Recommended Posts

i am trying to create a folder. In that folder i try to create a file through coding

it is executing well in my local host but it is not working in my server

$dir = "template/$company"; // getting the name of the folder
mkdir($dir, 0777);

$createfile = "index.php";
$file = fopen("template/$company/".$createfile, 'w+') or die("can't open file");  fclose($file);

i receive error like this while executing in my server

Warning: SAFE MODE Restriction in effect. The script whose uid is 10056 is not allowed to access /home/httpd/vhosts/buscandomusicos.com/httpdocs/template/xxx owned by uid 48

The file you are trying to create and the directory has different owner settings.
If SAFE MODE is on , you can't access another user's files. So make sure that , the directory and the file you are tryign to create has the same uid's.

Hope this helps you!
Actually i want to create a folder for every customer in that folder i want to create a file called index.php. then i want to write some code inside that index.php through coding.

if the customer give all the details this should be done. so now each customer will have seperate folder with index.php file inside

i already showen the coding what i have done it is executing in localhost but not in server error was produced is there any new way
yes xxx is the file name that is index.php


Actually i created folder in my server but through

mkdir($foldername,0777);

whenever i call this code it is creating a folder in different name but inside this folder i want to create a file name called index.php

i wrote like this

$createfile = "index.php";
$file = fopen("template/$company/".$createfile, 'w+') or die("can't open file");
fclose($file);

but what happen folder is created but index.php file is not created that error was produced.


As per as i know, I think there is a file already called index.php in template folder.That is not created by some another user.when you try to open a new file , it is trying to open the file in /templates/index.php. It is not going to the new folder.


So have a try on this.


$file = fopen("httpdocs/template/$company/".$createfile, 'w+') or die("can't open file");


Good Luck!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.