well so far this is a short code, however, I seem to have the problem that everytime I try and generate a random file it will not create this file to open, instead it just says it can't open the file. I want to know why this code will not work. The code is short so it shouldn't be hard to figure out.

<?PHP  

  //////THI-Paste//////
    $title = $_POST['title'];
    $type = $_POST['type'];    
$author = $_POST['author']; $info = $_POST['info']; $self= $_SERVER[&#8217;PHP_SELF&#8217;]; $n = 8; $x = 0; $ext = ".txt"; /////Make Random url / file function///////// function randomurl($length) { $pattern = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for($i=0;$i<$length;$i++) {
$url .= $pattern{rand(0,60)};
}
return $url; }
while($x < "1"){ $file = randomurl($n);
$link = fopen("$file$ext", 'x+') or die("Could not open file"); fwrite($link, "OMG it works"); fclose($link);
} ?>

    Could you insert some newlines into that code sample so we can read it?

      sorry about that, this better?

        Probably one of two things: either the webserver user under which your PHP scripts are run does not have write permission on the directory, or else the file already exists. If you add the following two lines somewhere before that command, you can make sure PHP is telling you as much debug info as it will:

        ini_set('display_errors', '1');
        error_reporting(E_ALL);
        
          Write a Reply...