Re: PHP &Apache Upload file Permission denied

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Michael,

I spent the better part of today trying to get a file upload script to work 
too. Same sort of problem: local linux works ok, but web - nope.

Looking at your error message, it might be the renaming of the temp file that 
is barfing.

if (($_FILES["pix"]["size"] > 0)&&($_FILES["pix"]["size"] < 75000)){

	if ($_FILES["pix"]["type"] == "image/jpeg")
	{
		$pix_file = $_FILES["pix"]["name"];
		$pix_temp_file = $_FILES["pix"]["tmp_name"];

		$new_pix_file = "1111-5.jpg";

		if(is_uploaded_file($pix_temp_file)){
			move_uploaded_file($pix_temp_file, "pix/$new_pix_file");
		}
	}
}
else {

print "<br><br><br><br><big><b>Picture Upload 
Error<b></big><br><br><h5>Filesize is greater than maximum 75k!<br><br> 
Please resize your picture to below 75k, and try again!</h5><br>";
}

This works for me -- might want to modify it and see if it clicks on yours. My 
pix directory is 777, uploaded files go in as apache:apache 755. (also, if 
you try to upload greater than limit set in apache, nothing will show up in 
'/var/www/htm/test/icons.zip'.
	      ^^^^^

Btw, is that a typo: 'htm' or did you want 'html'??

Hth,
Andre

On Sunday 12 December 2004 07:46 pm, Michael Leung wrote:
> Hi all,
>    I have faced the upload file permission denied for weeks. I can't
> write a new file/create a directory. I did a test in PHP standalone
> (Linux shell).  The operation is very normal.
> But in web environment, I got this error message:
>
> Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
> move '/tmp/phpjsLZfC' to '/var/www/htm/test/icons.zip' in
> /var/www/html/simple_upload.php on line 76.
>
> I think this is a problem bewteen Apache and PHP. The safe mode of PHP
> is off and test directory is changed to 777.
>
> yours,
> Michael

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux