mageeda Posted June 15, 2012 Share Posted June 15, 2012 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> Quote Link to comment https://forums.phpfreaks.com/topic/264251-php-code-works-in-dreamweaver-but-only-shows-code-when-on-hosting-site/ Share on other sites More sharing options...
xyph Posted June 15, 2012 Share Posted June 15, 2012 Your server doesn't support PHP? Quote Link to comment https://forums.phpfreaks.com/topic/264251-php-code-works-in-dreamweaver-but-only-shows-code-when-on-hosting-site/#findComment-1354199 Share on other sites More sharing options...
mageeda Posted June 15, 2012 Author Share Posted June 15, 2012 ya.. its godaddy.. it supports php.. how else can i browse a directory?? Quote Link to comment https://forums.phpfreaks.com/topic/264251-php-code-works-in-dreamweaver-but-only-shows-code-when-on-hosting-site/#findComment-1354201 Share on other sites More sharing options...
Mahngiel Posted June 15, 2012 Share Posted June 15, 2012 ya.. its godaddy.. it supports php.. how else can i browse a directory?? turn on Indexing through your .htaccess or apache configs Quote Link to comment https://forums.phpfreaks.com/topic/264251-php-code-works-in-dreamweaver-but-only-shows-code-when-on-hosting-site/#findComment-1354206 Share on other sites More sharing options...
mageeda Posted June 15, 2012 Author Share Posted June 15, 2012 where is the htaccess or apache? is that in my godaddy dashboard? Quote Link to comment https://forums.phpfreaks.com/topic/264251-php-code-works-in-dreamweaver-but-only-shows-code-when-on-hosting-site/#findComment-1354208 Share on other sites More sharing options...
Mahngiel Posted June 15, 2012 Share Posted June 15, 2012 you can create your own [tt.htaccess[/tt] and upload it to any directory you want. i have no idea how to use GoDaddy web hosting services. Quote Link to comment https://forums.phpfreaks.com/topic/264251-php-code-works-in-dreamweaver-but-only-shows-code-when-on-hosting-site/#findComment-1354217 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 15, 2012 Share Posted June 15, 2012 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!"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/264251-php-code-works-in-dreamweaver-but-only-shows-code-when-on-hosting-site/#findComment-1354228 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.