Jump to content

[SOLVED] writing files to a directory


thewooleymammoth

Recommended Posts

so this should place a file called 1.txt inside www.mysite.com/files/1.txt ?

<?php
$result=1;
$filename=files/$result.".txt";
$openfile = fopen($filename, "a") or die("could not open file $filename");
fwrite($openfile, 'this is the text');
?>

 

 

that doesnt work, it tries to devide files by 1 which is undefined so the file ends in the same directory called 0.txt

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.