Jump to content

Problem Saving File To Newly Created Folder


stevesimo

Recommended Posts

Hi, I have a script which creates a new folder on the server which I then want to save a textfile into.  The folder is being created and is CHMOD to 777 but the textfile is not being saved into the folder.  Can anyone see what I am doing wrong?  Not sure if my file path is incorrect.

 


  //create folder using id
  mkdir("./".$id, 0777);
  //now chmod to 0777
  chmod("./".$id."/", 0777);
  $output = 'Some text to save in file goes here...';
  //now save textfile using id as name
  $textpage = fopen("/".$id."/".$id.".txt","w");
  fwrite($textpage,$output);
  fclose($textpage);

 

Thanks, Steve

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.