barrowvian Posted March 28, 2010 Share Posted March 28, 2010 im currently making an upload images function to write a file that i have create upon submission from the previous page, this is the code i use; mkdir($thisdir ."/tempprofileimages" . "/temp.$firstname$surname", 0777); chmod($thisdir ."/tempprofileimages" . "/temp.$firstname$surname", 0777); However, when i try to upload the image to the newly created folder i still get the 'cannot write to file, please chmod 777 it'. How do i overcome this issue? Link to comment https://forums.phpfreaks.com/topic/196780-chmod-777-error/ Share on other sites More sharing options...
jmajeremy Posted March 28, 2010 Share Posted March 28, 2010 I expect it may be that the user executing scripts on your system (usually "nobody:nobody") doesn't have CHMOD permission. Also, I have to ask why are you using concatenation here: "/tempprofileimages" . "/temp.$firstname$surname" ? It's the same things as doing "/tempprofileimages/temp.$firstname$surname" . Also, you don't need to specify the mode (permissions) since the default value of mkdir() is 0777. The only other thing I'd suggest is that you try doing it recursively ( mkdir($dir, , TRUE); ). Link to comment https://forums.phpfreaks.com/topic/196780-chmod-777-error/#findComment-1033070 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.