• Resolved quan3t

    (@quan3t)


    How to read/write a file? I have a directory call “tempd” on my server. Directory is set to 777. Inside directory I have two files “readfile.php” and “writefile.php”. They both are 777 as well. I copy a template in my theme folder and call it “testtemplate.php”. In this new template I have the following code but it is not working. Any help would be greatly appreciated.

    <?php
    $handle = fopen('http://www.example.com/tmpd/readfile.php','r');
    $data = fread($handle, filesize($handle));
    fclose($handle);
    $handle1 = fopen('http://www.example.com/tmpd/writefile.php','w');
    $newdata = 'My name is '.$data;
    fwrite($handle1,$newdata);
    fclose($handle1);

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to read/write a file?’ is closed to new replies.