Jump to content

Create a file which is chmod 777


MadnessRed

Recommended Posts

The touch() function sets the access and modification time of the specified file.

how does that help me?

 

 

how about this code though?

//First set the file path
$file = $_get['directory'].'/'.$_get['name'].'.txt';

//now the option to put in some content, blank atm
$content = "";

//Now we don't want to damage an existing files
if (file_exists($file)) {
   echo 'Error, file already exists';
}else{
   //Create the file
   file_put_contents($file,$content);
   //Make it writeable
   chmod($file,0777);
   //Success, lets tell them
   echo 'File made successfully';
}

Link to comment
Share on other sites

yh but i use unix through gnome, not php

 

how about this code then?

 

//First set the file path
$file = $_get['directory'].'/'.$_get['name'].'.txt';

//now the option to put in some content, blank atm
$content = "";

//Now we don't want to damage an existing files
if (file_exists($file)) {
   echo 'Error, file already exists';
}else{
   //Create the file
   touch($file);
   //Make it writeable
   chmod($file,0777);
   //Add contents is I decide to make them
   file_put_contents($file,$content);
   //Success, lets tell them
   echo 'File made successfully';
}

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.