[PHP] Using touch() to create a file

I’m trying to create a file when I add a new entry to my MySQL Database, but I keep getting this error:

Warning: unable to create file /home/portfolio/www/portfolio/102984.php because Permission denied in /home/portfolio/www/admin/admin_portfolio.php on line 49

I have chown’d both directories (admin & portfolio), but it still isnt allowing me to create the file. Any idea on what I can do?


		$filename = $_POST['link']; 
		if (!file_exists($_SERVER['DOCUMENT_ROOT'].'/portfolio/' . $filename)) { 
 		 touch ($_SERVER['DOCUMENT_ROOT'].'/portfolio/' . $filename);