peterbarone Posted February 13, 2011 Share Posted February 13, 2011 I'm having a problem setting file permissions. Can someone give a little guidance. if(is_uploaded_file($_FILES['file']['tmp_name'])){ move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']); chmod($_FILES['file']['tmp_name'],0777); The permissions are not being set ? I made sure the dir was chmod correct. Thanks Link to comment https://forums.phpfreaks.com/topic/227542-chmod-a-file/ Share on other sites More sharing options...
The Little Guy Posted February 13, 2011 Share Posted February 13, 2011 you don't want to chmod the tmp file, you want to chmod the uploaded file. If your having issues uploading to a directory, then you want to chmod the directory. Link to comment https://forums.phpfreaks.com/topic/227542-chmod-a-file/#findComment-1173724 Share on other sites More sharing options...
peterbarone Posted February 13, 2011 Author Share Posted February 13, 2011 if(is_uploaded_file($_FILES['file']['tmp_name'])){ move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']); if(strtoupper(substr(PHP_OS,0,3))!="WIN") @chmod($_FILES['file']['name'],0777); } Thanks for that find, my typo. still loading the file to 640. Any other ideas ? Link to comment https://forums.phpfreaks.com/topic/227542-chmod-a-file/#findComment-1173729 Share on other sites More sharing options...
The Little Guy Posted February 13, 2011 Share Posted February 13, 2011 Try this: chmod($uploaddir.'/'.$_FILES['file']['name'],0777); Link to comment https://forums.phpfreaks.com/topic/227542-chmod-a-file/#findComment-1173735 Share on other sites More sharing options...
peterbarone Posted February 13, 2011 Author Share Posted February 13, 2011 THANKS ALOT. got the permission to change to 755. chmod($uploaddir.'/'.$_FILES['file']['name'],0777); Is there a better way to set the permission RE: 0777 Link to comment https://forums.phpfreaks.com/topic/227542-chmod-a-file/#findComment-1173741 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.