The Little Guy Posted January 11, 2007 Share Posted January 11, 2007 OK... I have a PHP file permissions set to chmod("file.php", '0666');and when I go to the location of the file it runs, why? Quote Link to comment https://forums.phpfreaks.com/topic/33722-chmod-problem/ Share on other sites More sharing options...
ted_chou12 Posted January 11, 2007 Share Posted January 11, 2007 What do you mean by this: "when I go to the location of the file it runs"From my knowledge, chmod your files to 666 will still give public the access of your file, if you want to block the access fully, 444 would be much better... Quote Link to comment https://forums.phpfreaks.com/topic/33722-chmod-problem/#findComment-158116 Share on other sites More sharing options...
The Little Guy Posted January 11, 2007 Author Share Posted January 11, 2007 why are the chmod properties being set? I change them, and nothing happens, it is all ways the same permissions even when I do change them.Maybe I'm doing it wrong:chmod(move_uploaded_file($tmp_name, "users/$_SESSION[user]/".strtolower($name)),0444); Quote Link to comment https://forums.phpfreaks.com/topic/33722-chmod-problem/#findComment-158117 Share on other sites More sharing options...
ted_chou12 Posted January 11, 2007 Share Posted January 11, 2007 try separating the move file from the chmod, so your statement is more clear, like:move_uploaded_file($tmp_name, "users/$_SESSION[user]/".strtolower($name));chmod("users/$_SESSION[user]/", 0444); Quote Link to comment https://forums.phpfreaks.com/topic/33722-chmod-problem/#findComment-158118 Share on other sites More sharing options...
The Little Guy Posted January 11, 2007 Author Share Posted January 11, 2007 ok... Now I have this:$movedfile = move_uploaded_file($tmp_name, "users/$_SESSION[user]/".strtolower($name));chmod($movedfile,0000);It did nothing. Quote Link to comment https://forums.phpfreaks.com/topic/33722-chmod-problem/#findComment-158121 Share on other sites More sharing options...
HuggieBear Posted January 11, 2007 Share Posted January 11, 2007 What OS are you running on?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/33722-chmod-problem/#findComment-158123 Share on other sites More sharing options...
ted_chou12 Posted January 11, 2007 Share Posted January 11, 2007 What I think is the problem, is that move_uploaded_file() does not return a filename, so you cannot chmod it..try echoing $movedfile, see if it gives you a filename with the correct path.but I dont know...Ted Quote Link to comment https://forums.phpfreaks.com/topic/33722-chmod-problem/#findComment-158125 Share on other sites More sharing options...
magic2goodil Posted January 11, 2007 Share Posted January 11, 2007 you might try $_FILES['postedname']['name'] where postedname is the name of your post field in your upload form.. Quote Link to comment https://forums.phpfreaks.com/topic/33722-chmod-problem/#findComment-158129 Share on other sites More sharing options...
The Little Guy Posted January 11, 2007 Author Share Posted January 11, 2007 I figured it out, I needed one more like, it now looks like this:move_uploaded_file($tmp_name, "users/$_SESSION[user]/".strtolower($name));$movedfile = "users/$_SESSION[user]/".strtolower($name);chmod($movedfile,0444);Thanks for the help, separating the functions really helped. Quote Link to comment https://forums.phpfreaks.com/topic/33722-chmod-problem/#findComment-158130 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.