Page 1 of 1

directory permission

Posted: Thu Oct 09, 2003 3:34 am
by dibyendra
hello phpdevs,
I have small upload script which uploads the file in the upload directory.

Code: Select all

<?php
if(isset($HTTP_POST_VARS["Submit"]))
{
	if ($fupload_size > 307200)//if greater than 300KB 
	{
		header("Location:error.php");
		exit;
	}	
              else
	{
	if(!copy ($fupload, "upload/$fupload_name"))
	     echo "failed to copy the image";
	else
	     header("Location:thanks.php");
	}
}	
?>
when i execute the script in locally it uploads the file but when I execute it in online it displays the error :
failed to create stream: Permission denied
how can I change the directory read/write by php chmod?
please Help.

Posted: Thu Oct 09, 2003 4:04 am
by thomas777neo
This should work:

Code: Select all

chmod ("/somedir/somefile", 0755);  // octal; correct value of mode

This is for a linux based os.

The only chmods allowed are the 775 and 666 mod. 775 for non-writeable and 666 for writeable. The only thing is that the usergroups don't work.
Note: the 0 at the start doesn't work with windows. use only the decimal kind.

Hope this helped