Johnny G Junior's NoteBook Treasures: testing directory for WRITE permission

Thursday, April 17, 2008

testing directory for WRITE permission

ok. this is just a directory test to see if you can execute a script to create a file on your server.


Create a new PHP file and name it what you want. heres your code.

 ////  
 $filename = "createdfile.txt";  
 $container = fopen($filename, 'w');  
 $content .= "this is content getting created in your text doc. WOW!";  
 $rwstatus = fwrite($container, $content);  
 fclose($container);  
   
 if(!$rwstatus)  
 {  
  echo "You do not have Read and Write permissions…creating files do not work. change your settings to 777 on your folder directory";  
 }  
 else  
 {  
  echo "you're the master. file was saved!";  
 }  
 ?>  


Upload and test file. if it works then a file will be created on your server call createdfile.txt.


Have fun!

No comments: