View Single Post
  #5 (permalink)  
Old 11-14-08, 06:08 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Your probably forgetting to add a slash between the folder path and the file name.

Try it like this:
PHP Code:

<?php
$path
=dirname(__FILE__);
$slash=strpos($path,'/') ? '/' '\\';
define('BASE_DIR',$path.$slash);
$folder="myFolder";          // folder name
$dirPath=BASE_DIR.$folder;   // folder path
$file_name="myFile.txt";     // file name
if(@mkdir($dirPath,'0777'))
{
 
touch($dirPath.$slash.$file_name);
 echo 
"The folder and file was successfully created.<br /><b>".$dirPath.$slash.$file_name."</b><br />";
 }
else
{
 echo 
"There was a problem creating the folder or the file.<br />
       Either the folder already exists or you do not have permission to create the folder or file.<br /><b>"
.
       
$dirPath.$slash.$file_name."</b><br />";
 }
?>
__________________
Jerry Broughton

Last edited by job0107; 11-14-08 at 06:34 AM.
Reply With Quote