aximbigfan Posted February 5, 2008 Share Posted February 5, 2008 Hi, I'm making a system where a user can upload a config file for a PHP app I made. I am runngi nint oa lot of problems. here is what I have thus far: unlink('config.php'); move_uploaded_file($_FILES['upload']); if ($_FILES['upload']['name']!=config.php) rename("$_FILES['upload']['name']","config.php"); echo "ok"; What should I do to this to make it work? Thanks very much, Chris Quote Link to comment https://forums.phpfreaks.com/topic/89508-file-uploads/ Share on other sites More sharing options...
Jerzxu Posted February 5, 2008 Share Posted February 5, 2008 Your if statement doesn't have the {}'s in it. unlink('config.php'); move_uploaded_file($_FILES['upload']); if ($_FILES['upload']['name']!=config.php){ rename("$_FILES['upload']['name']","config.php"); echo "ok"; } Quote Link to comment https://forums.phpfreaks.com/topic/89508-file-uploads/#findComment-458452 Share on other sites More sharing options...
aximbigfan Posted February 5, 2008 Author Share Posted February 5, 2008 It's suppose to be like that 1. Delete the existing config.php 2. Copy the new config.php in to it's place 3. Is the new config.php named config.php? 3A. If NO rename the new config.php to config.php 4. Say ok. Chris Quote Link to comment https://forums.phpfreaks.com/topic/89508-file-uploads/#findComment-458710 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.