Jump to content

PHP code works in dreamweaver but only shows code when on hosting site


mageeda

Recommended Posts

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>

 

 

 

If you are working with GoDaddy Hosting Platform, all php should be working. Do check if the name is .php just to ensure its not the naming problem. Try creating a php file and with the following code and see it if works.

 

<?php
echo "It is working!";
?>

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.