Jump to content

Recommended Posts

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.