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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites


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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.