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>

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.