Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method ="post">
File Name:<input type="text" id="file">
<br/>
<input type="submit" id="submit" value="Submit">
</form>
</body>
</html>
<?php
$filename = $_GET['file'];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$create=fopen($filename , "w");
fopen($create, 'w');
fclose($create);
}
?>
I get this error:
Warning: fclose(): supplied argument is not a valid stream resource in /Applications/xampp/xamppfiles/htdocs/preorder/content.php on line 32
I am not sure why.
Thanks.