I need help. I am trying to figure out why some code i copied and pasted into dreamweaver works in that program but once i create a index.php file and put it on the hosting site when i try to run it - all i see is the code on the page...
can someone help??? here is the code.. it should just display the files in the folder...
thanks
<?php
if ($_POST['submit'])
{
copy($_FILES['file']['tmp_name'], $_FILES['file']['name']);
}
?>
<html>
<head><title>page</title>
</head>
<body>
<?php
$dir=opendir(".");
$files=array();
while (($file=readdir($dir)) !== false)
{
if ($file != "." and $file != ".." and $file != "index.php")
{
array_push($files, $file);
}
}
closedir($dir);
sort($files);
foreach ($files as $file)
print "[A href='$file'>$file</a]
";
?>
<form action='<?php echo $PHP_SELF ?>' enctype='multipart/form-data' method='POST'>
Add a new file: <input type='file' name='file'>
<input type='submit' name='submit' value='Add File!'>
</form>
</body>
</html>