Displaying Images from a database or should it be stored elswhere?

Dear Anyone,
I am in need of serious help here. I created two tables in a database one to store information about a compmany and its logo while the other stores images. Both of which are in a database. Here are the tables:

CREATE TABLE user (
    	userID MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
    	fname VARCHAR(20) NOT NULL,
	lname VARCHAR(20) NOT NULL,
	email VARCHAR(80) NOT NULL,
	category VARCHAR(40) NOT NULL,
	membership VARCHAR(20) NOT NULL,
	location VARCHAR(80) NOT NULL,
	username VARCHAR(30) NOT NULL,
    	password CHAR(40) NOT NULL,
	reg_date CURDATE() NOT NULL,
	PRIMARY KEY (userID),
	UNIQUE(username),
	INDEX(password, username),
	UNIQUE(email)
) ENGINE=INNODB;

CREATE TABLE logo (
	userID MEDIUMINT UNSIGNED NOT NULL,
	logoID INT NOT NULL  AUTO_INCREMENT,
	filename VARCHAR(255) NOT NULL,
   	mimetype VARCHAR(50) NOT NULL,
         filedata MEDIUMBLOB,
	brandIdentity LONGTEXT NOT NULL,
	history LONGTEXT NOT NULL,
	PRIMARY KEY (logoID),
	FOREIGN KEY (userID) REFERENCES user(userID)
) ENGINE=INNODB;

CREATE TABLE design (
	userID MEDIUMINT UNSIGNED NOT NULL,
	dID INT NOT NULL  AUTO_INCREMENT,
	cat VARCHAR(40) NOT NULL,
	filename VARCHAR(255) NOT NULL,
   	mimetype VARCHAR(50) NOT NULL,
   	description VARCHAR(255) NOT NULL,
   	filedata MEDIUMBLOB,
	PRIMARY KEY (dID),
	FOREIGN KEY (userID) REFERENCES user(userID)
) ENGINE=INNODB;

I have some scripts that all people to login and upload into the last 2 tables. which are:

loggedin.php

<?php
		session_start(); // Start the session.

		// If no session value is present, redirect the user:
		ob_start();
		if (!isset($_SESSION['userID'])) {
			require_once ('loginFunction.inc.php');
			$url = absolute_url();
			header("Location: ".$url);
			exit();	
		}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Welcome to ADesigns: Home</title>
    <link href="css/main.css" rel="stylesheet" type="text/css" />
</head>

<body>

<table id="outerTable">
	<tr><td id="logo">
		<div>
			<img src="./images/logo.png" width="150"  height="55"  alt="company_logo" />
		</div>
	</td></tr>
	<tr><td id ="nav">
		<div>
			<a href="home.html">Home</a> |  
			<a href="participate.html">Participate</a> |
			<a href="aboutUs.html">About ADesigns</a> |
			<a href="contact.html">Contact Us</a>
		</div>
	</td></tr>
	<tr><td id="banner"> <! -- page banner image -->
		<img src="images/home.jpg" width="770" height="" alt="welcome to ADesigns">
	</td></tr>
	<tr><td>
		<table id="contentTable">
			<tr>
				<td id="topLeft">
					<br />
					<div id="welcomeBox">
						<h1>Advertisments</h1>
						<p>This section covers adverts from other companies</p>
					</div> <! -- mainContent -->
				</td>
				<td id="topRight">
					<br />
					<div id="loginRegBox">
					
					<?php	

						// Print a customized message:
						echo "<h1>Logged In!</h1> <p>You are now logged in, {$_SESSION['fname']}!</p>";
					?>
					<p><b>Congratualtion</b> on your successful login to our website. Now you can start the
					fun part and upload your designs. All you have to do is fill up the blanks appropriately.</p>
					
					<p><b>Note:</b> For each upload, you will need to specify that it is a 
					logo for your design, a picture of yourself or one of your designs.</p>
					<p>For ease of use you need to upload one file each for the following:</p>
						
					<p><b>Photograph:</b> a small picture of yourself for visitors to see. Only need once.</p>
					<p><b>Logo:</b> your company logo. Also only need one.</p>
						
					<form method="post" action="loggedin_v2.php" enctype="multipart/form-data" >
							<!--<div>
								<label for="uploadPhoto">Upload Photograph:</label>
								<input type="file" name="uploadPhoto"  id="upload"/>
							</div> -->
							<div>
								<label for="uploadLogo">Upload Logo:</label>
								<input type="file" name="uploadLogo"  id="upload"/>
							</div>
							
							<!--
								I do not need you at the moment:
								<div>
									<label for="imgType">Image Type:</label>
									<input type="radio" name="imageType" id="logo" value="logo" />Logo
									<input type="radio" name="imageType" id="photo" value="photo" />Photo
									<input type="radio" name="imageType" id="design" value="design" />Design
								</div>
							-->
							<div>
								<label for="brandID">Brand Identity:</label>
								<textarea name="brandID" rows="4" cols="40" id="brandID"></textarea>
							</div>
							<div>
								<label for="history">Please tell us about yourself:</label>
								<textarea name="history" rows="20" cols="40" id="history"></textarea>
							</div>
						
							<div>
								<input type="submit" name="btnSubmit" id="btnSubmit" value="Upload" />
							</div>
							
							
							
					</form>
					<p><a href="logout.php">Logout</a></p>
					</div> <! -- mainContentRight -->
			</tr>
			
		</table>
	</td></tr>
	<tr><td  id="footer"><div id="footerLastRow"><p>&copy; ADesigns  &nbsp;&nbsp; <a href="#">Privacy Policy</a> | <a href="#">Terms and Conditions</a></p></div></td></tr>
</table>



</body>
</html>


the one that processes the above from the form posted:

<?php
	
		/*Upon submission of scriipt from loggedin.php
		 *the form is sent here for process
		 */

		session_start(); //start session
		ob_start(); //prevent header errors
		
		if (!isset($_SESSION['userID']) )	{
			require_once ('loginFunction.inc.php');
			$url = absolute_url();
			header("loaction: " .$url);
			exit();
		}
		
		if ( isset($_GET['action']) )	
		{	
		$action = $_GET['action'];	
		}
	
		else	
		{
		$action = "";
		
		}
		
		$page_title = 'Welcome to ADesigns: Logged In!';
		include ('includes/header.html');
		
		$userID = $_SESSION['userID'];
		require_once('mysql_connect.php');	
		
		//This processes the logo uploads:
		
		if (isset($_FILES['uploadLogo']) )	
		{
			
			$brandID =trim($_POST['brandID']);
			
			$history =trim($_POST['history']);
				
		   /* I want to do a check to see if logo akready exists in the database
			* If it does, I want to redirect the designer to the page where you can 
			* edit the logo table and it is at this same place that you will be allowed
			* to upload your designs over and over again.
			*/
		
			// 	Bail out if the file isn't really an upload.
			if (!is_uploaded_file($_FILES['uploadLogo']['tmp_name']))	
			{
				exit('There was no file uploaded!');
			}
		
			$uploadfile		=	$_FILES['uploadLogo']['tmp_name'];
			$uploadname		=	$_FILES['uploadLogo']['name'];
			$uploadtype		=	$_FILES['uploadLogo']['type'];
			$uploadBrandID	=	$_POST['brandID'];
			$uploadHistory	=   $_POST['history'];
			
			//	Open file or binary reading ('rb')
			$tempfile = fopen($uploadfile, 'rb');
		
		
			//	Read the entire file into memory using PHP's
			//	filesize fucntion to get the size.
			$filedata = fread($tempfile, filesize($uploadfile));
		
			//	Prepare for database insert by adding backslashes
			//	before special characters.
			$filedata = addslashes($filedata);
		
			
			
				//If all goes according to plan:
				
				
			
				//	Create the SQL query.
				$sql = "INSERT INTO logo SET 
					userID = '$userID',
					filename = '$uploadname', 
					mimetype = '$uploadtype',
					filedata = '$filedata',
					brandIdentity = '$uploadBrandID',
					history = '$uploadHistory'";
				
				//	Perform the insert.
				$ok = @mysql_query($sql);
		
				if(!$ok)	
				{
					exit('Database error storing file: ' . mysql_error());
				}
				
				
				header('location: ' . $_SERVER['PHP_SELF']);
				exit();
			
		
	     }
	     
	     
	     
	     // This only processes the designs uploadd:
	     if (isset($_FILES['uploadDesign']) )	
		 {
			
				
			// 	Bail out if the file isn't really an upload.
		
			if (!is_uploaded_file($_FILES['uploadDesign']['tmp_name']))	
			{
				exit('There was no file uploaded!');
			}
		
			$uploadfile		=	$_FILES['uploadDesign']['tmp_name'];
			$uploadname		=	$_FILES['uploadDesign']['name'];
			$uploadtype		=	$_FILES['uploadDesign']['type'];
			
			
			//	Open file or binary reading ('rb')
			$tempfile = fopen($uploadfile, 'rb');
		
		
			//	Read the entire file into memory using PHP's
			//	filesize fucntion to get the size.
			$filedata = fread($tempfile, filesize($uploadfile));
		
			//	Prepare for database insert by adding backslashes
			//	before special characters.
			$filedata = addslashes($filedata);
		
			
			
				//If all goes according to plan:
				
				
			
				//	Create the SQL query for uploading designs.
				$sql = "INSERT INTO design SET 
					userID = '$userID',
					filename = '$uploadname', 
					mimetype = '$uploadtype',
					filedata = '$filedata'";
				
				//	Perform the insert.
				$ok = @mysql_query($sql);
		
				if(!$ok)	
				{
					exit('Database error storing file: ' . mysql_error());
				}
				
				
		
				header('location: ' . $_SERVER['PHP_SELF']);
				exit();
			
		
	     }

	     
	     
	     /*This script processes the body.php
	      *
	      *There is a problem here:
	      */
	     
	    else if ( ($action == 'view' or $action == 'dnld') and isset($_SESSION['userID'] )	)
		{
			
		
			$id = $_GET['id'];
			echo'You are here';
		
			//	User is retreving a file
		
			$sql = "SELECT filename, mimetype, filedata FROM logo WHERE logoID = '$id' ";
			$result = @mysql_query($sql);
		
			if (!$result)	
			{
				exit('Database error: ' . mysql_error());
			}
		
			$file = mysql_fetch_array($result);
		
			if(!$file)	
			{
				exit('File with given ID not found in database!');
			}
		
			$filename     = $file['filename'];
			$mimetype     = $file['mimetype'];
			$filedata     = $file['filedata'];
			$disposition  = 'inline';
		
			if ($action == 'dnld')	
			{
				$disposition  = 'attachment';
			
				if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5') or strpos($_SERVER['HTTP_USER_AGENT'], 'Opera 7') ) 	
				{
					$mimetype = 'application/x-download';
				}
			}
		
		
			header("content-disposition: $disposition; filename=$filename");
			header("content-type: $mimetype");
			header('content-lenght: ' . strlen($filedata));
		
			echo ($filedata);
			exit();
	}
	
	/*else if($action == 'del' and isset($_SESSION['userID'] )) 
	{
			$id = $_GET['id'];
		
			//	User deleting a file
		
			$sql = "DELETE FROM logo WHERE id = '$id'";
			
			$ok = @mysql_query($sql);
		
			if (!$ok)	
			{
				exit('Database error: ' . mysql_error());
			}
		
			header('location: ' . $_SERVER['PHP_SELF']);
			exit();
	}*/
	
	 else if ( ($action == 'viewD' or $action == 'dnldD') and isset($_SESSION['userID'] )	)
		{
			
		
			$id = $_GET['id'];
			//echo'You are here';
		
			//	User is retreving a file
		
			$sql = "SELECT filename, mimetype, filedata FROM design WHERE dID = '$id' ";
			$result = @mysql_query($sql);
		
			if (!$result)	
			{
				exit('Database error: ' . mysql_error());
			}
		
			$file = mysql_fetch_array($result);
		
			if(!$file)	
			{
				exit('File with given ID not found in database!');
			}
		
			$filename     = $file['filename'];
			$mimetype     = $file['mimetype'];
			$filedata     = $file['filedata'];
			$disposition  = 'inline';
		
			if ($action == 'dnldD')	
			{
				$disposition  = 'attachment';
			
				if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5') or strpos($_SERVER['HTTP_USER_AGENT'], 'Opera 7') ) 	
				{
					$mimetype = 'application/x-download';
				}
			}
		
		
			header("content-disposition: $disposition; filename=$filename");
			header("content-type: $mimetype");
			header('content-lenght: ' . strlen($filedata));
		
			echo ($filedata);
			exit();
	}
	
include('includes/body.php');
?>
                                                                                         
<?php

include('includes/footer.html');

?>

The following is supposed to display the details stored in the logo table but I only all expect the actual binary code for the logo image is displayed and not the logo image. Why is this so can anyone show me the right way around this issue? I am in need of serious help. There was something similar in this post:

Thank you.

I find that it is far easier to store just the filenames in the database and all the images in a seperate folder. The database will be far smaller and easier to export, each image can be enhanced, optimised or completely replaced.

.

I never store the actual image data files in the database due to possible size problems when performing queries etc too.

To reinforce the last two answers… do not store images in databases… it causes all sorts of problems.

Here is how I would do it:

Create a folder on your webserver called uploaded_images (or whatever) … (possibly use amazon S3 if you are expecting a lot of traffic)

When a user uploads a file, make sure the file is what you are expecting… (image, correct extension etc…)

Next, assign a random name to the image

Move the image to the uploaded_images dir

Enter the name of the image into the database.

Your table might look something like this:

name: logo.gif
rndname: 1234xyz.gif
other_data: etc…

To answer your primary question you will need to use a separate script to serve up the image. So image request will actually be something like:

<img src=“/image.php?id=9”>

The image.php file would than fetch the image data for primary key 9, set the header as an image type and output the binary image data.

You can’t output the image on the same script your using for the application code. The image request needs to be its own request or script.

So are you saying I have to do a complete overhaul of the scripts and database?

Please if you do not mind can you give a script example of how to implement such described above.

Pleeeeeeeeeeeese

You are mixing two file formats, html and an image format. Most html pages of course do not do that. A separate script must be used to represent the image, or you need to use a data uri (google is your friend) embed of the image data. Not all browsers support data uri so the best course of action is to serve dynamic images separately. Secondly, storing even small images in a database is not advisable. That is what the file system is for. The only real reason to store binary or other file format data in the database is if you need the extra security access control available in database systems.

Please can you write a script that can mimic such. I do not know why but I was under the impression that a database was where you store the image and retrieve to display. Are you saying I have restructure those tables?

I know you said Google is my friend like you said but I REALLY NEED help with this.

Regards

In place of the image data field, you can save the name of the image and the mime type. That information can then be echoed into the src attribute of an image tag. The only reason to use a script to serve the images is if you need to track the use of the images, restrict access to them, or auto-generate all or part of the images. All of those procedures are beyond the scope of a forum post, but the basics of serving an image using PHP would be something like this.


<img src="serveimage.php?imgid=<?php echo $imageid; ?>" />


in serveimage.php


$image = 'imagenotfound.gif';
$type = 'image/gif';
$imgid = (int) $_GET['imgid'];
$conn = mysql_connect('localhost','user','pass');
if($conn)
{
   if(mysql_select_db('mydatabase'))
   {
      $sql =<<<SQLSTM
   SELECT
         *
         FROM images
               WHERE
                   id = $imgid
SQLSTM;
         if($result = mysql_query($sql,$conn))
         {
             $path = '/home/mysite/images/';
             $imagename = mysql_result($result,0,'imagename');
             if(file_exists($path.$imagename))
            {
               $type = mysql_result($result,0,'imagemimetype');
               $image = $path.$imagename;
            }
         }
   }
}
if($handle = fopen($image,'r'))
{
    $content = fread($handle);
    fclose($handle);
    header('Content-Type:'.$type);
    die($content);
}
else
{
   die('Error opening image');
}


So in my database table, the one i use to store logos, do I then just store only the filename and mimetype of the image there and then store the actual image in the folder alled uploads?

Regards.

Yes. It can then be retrieved in whatever manner you choose.

Yes it does

I am back and with questions. I took you advice and restructed the database so that my logo and design tables look like this:

CREATE TABLE logo (
	userID MEDIUMINT UNSIGNED NOT NULL,
	logoID INT NOT NULL  AUTO_INCREMENT,
	filename VARCHAR(255) NOT NULL,
   	mimetype VARCHAR(50) NOT NULL,
	PRIMARY KEY (logoID),
	FOREIGN KEY (userID) REFERENCES user(userID)
) ENGINE=INNODB;

CREATE TABLE design (
	userID MEDIUMINT UNSIGNED NOT NULL,
	dID INT NOT NULL  AUTO_INCREMENT,
	filename VARCHAR(255) NOT NULL,
   	mimetype VARCHAR(50) NOT NULL,
	PRIMARY KEY (dID),
	FOREIGN KEY (userID) REFERENCES user(userID)
) ENGINE=INNODB;

Then I created the a folder called uploads and it has two paths

one for the logo i.e uploads/logo
the other for the designs i.e uploads/design

and the parent folder uploads is placed in the same directory as where all scripts are.

I made a new script for uploading a logo as follows:

loggedin.php:

<?php
		session_start(); // Start the session.

		// If no session value is present, redirect the user:
		ob_start();
		if (!isset($_SESSION['userID'])) {
			require_once ('loginFunction.inc.php');
			$url = absolute_url();
			header("Location: ".$url);
			exit();	
		}
		
		$page_title = "Welcome to ADesigns: {$_SESSION['fname']}";
		include('includes/header.html');

		// Print a customized message:
		echo "<h1>Logged In!</h1> <p>You are now logged in, {$_SESSION['fname']}!</p>";
				
		echo '<p><b>Congratualtion</b> on your successful login to our website. Now you can start the
		fun part and upload your designs. All you have to do is fill up the blanks appropriately.</p>';
					
		echo'<p><b>Note:</b> For each upload, you will need to specify that it is a 
		logo for your design, a picture of yourself or one of your designs.</p>
		<p>For ease of use you need to upload one file each for the following:</p>';
		
		echo'<p><b>Logo:</b> your company logo. Also only need one.</p>';
						
		
			
		
?>

			
			<form method="post" action="uploads.php" enctype="multipart/form-data" >
					
				<input type="hidden" name="MAX_FILE_SIZE" value="524288">	
				<div>
					<label for="uploadLogo">Upload Logo:</label>
					<input type="file" name="logo"  id="logo"/>
				</div>
				<div>
					<input type="submit" name="submitted" id="btnSubmit" value="Upload" />
				</div>
							
			</form>			
<?php

	echo'<p><a href="logout.php">Logout</a></p>';
		include('includes/footer.html');
?>


This processes the above script (uploads.php)

 <?php
session_start(); //start session
ob_start();
if (!isset($_SESSION['userID']) )	
 {
	require_once ('loginFunction.inc.php');
	$url = absolute_url();
	header("loaction: " .$url);
	exit();
  }	 

 $userID = $_SESSION['userID'];
 
 if (isset($_POST['submitted'])) 
 {

	// Check for an uploaded file:
	if (isset($_FILES['logo'])) 
	{
	
		// Exit if it is not a logo upload:
		if (!is_uploaded_file($_FILES['logo']['tmp_name']))	
			{
				exit('There was no logo file uploaded!');
			}
			
			$logoname		=	$_FILES['logo']['name'];
			$logotype		=	$_FILES['logo']['type'];
		
		// Validate the type. Should be JPEG or PNG.
		$allowed = array ('image/pjpeg', 'image/jpeg', 'image/JPG', 'image/X-PNG', 'image/PNG', 'image/png', 'image/x-png');
		if (in_array($_FILES['logo']['type'], $allowed)) 
		{
		
			// Move the file over.
			if (move_uploaded_file ($_FILES['logo']['tmp_name'], "../uploads/logo/{$_FILES['logo']['name']}")) 
			{
				echo '<p><em>The file has been uploaded!</em></p>';
			} // End of move... IF.
			
			// Store the other logo details in the database:
			require_once('mysql_connect.php');
			
			$logoInsert = "INSERT INTO logo SET 
							userID = '$userID',
							filename = '$logoname', 
							mimetype = '$logotype'";
				
			//	Perform the insert.
			$ok = @mysql_query($logoInsert);
		
				if(!$ok)	
				{
					exit('Database error storing file: ' . mysql_error());
				}
			
		} 
		else 
		{ 
			// Invalid type.
			echo '<p class="error">Please upload a JPEG or PNG image.</p>';
		}

	} // End of isset($_FILES['logo']) IF.
	
	// Check for an error:
	
	if ($_FILES['logo']['error'] > 0) 
	{
		echo '<p class="error">The file could not be uploaded because: <strong>';
	
		// Print a message based upon the error.
		switch ($_FILES['logo']['error']) 
		{
			case 1:
				print 'The file exceeds the upload_max_filesize setting in php.ini.';
				break;
			case 2:
				print 'The file exceeds the MAX_FILE_SIZE setting in the HTML form.';
				break;
			case 3:
				print 'The file was only partially uploaded.';
				break;
			case 4:
				print 'No file was uploaded.';
				break;
			case 6:
				print 'No temporary folder was available.';
				break;
			case 7:
				print 'Unable to write to the disk.';
				break;
			case 8:
				print 'File upload stopped.';
				break;
			default:
				print 'A system error occurred.';
				break;
		} // End of switch.
		
		print '</strong></p>';
		
	} // End of error IF.
	
	// Delete the file if it still exists:
	if (file_exists ($_FILES['logo']['tmp_name']) && is_file($_FILES['logo']['tmp_name']) ) 
	{
		unlink ($_FILES['logo']['tmp_name']);
	}
			
} // End of the submitted conditional.
?>

When I run that I get the following errors:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /Users/nosikeadah/Sites/myQmProj/uploads.php:1) in /Users/nosikeadah/Sites/myQmProj/uploads.php on line 2

Warning: move_uploaded_file(…/uploads/logo/lad-musician-garbadine-mod-coat-1.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /Users/nosikeadah/Sites/myQmProj/uploads.php on line 36

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/private/var/tmp/phpR0pc4P’ to ‘…/uploads/logo/lad-musician-garbadine-mod-coat-1.jpg’ in /Users/nosikeadah/Sites/myQmProj/uploads.php on line 36

Any solutions?

Regards

Please do not get angry but I do not understand.

The session system sends a browser a cookie which sends an http header. You cannot have any output sent before a session cookie is set or any other http header is sent. move_uploaded_file is likely failing because of permission problems with the destination directory. The user account that PHP runs under (if using the apache module it will be the same user as the web server “apache”,“nobody” or “www”) must have write access to the destination directory. If you have shell access to the server it is best for the web server user to be in the group for the file with permissions set to 775. You cannot change group or ownership over FTP.

No problem. When you call session_start() the server sends the browser a session cookie. This is done in an http header. Headers are always the first thing sent to the browser, before any html or any other output. If you send any output to the browser before you call session_start() then it will cause that error. That function must be called at the very top of the file with no file included before it.

Read up on UNIX permissions, unless of course you are serving the site on Windows. The web server operates as a user on the system. That user is usually “apache” or “www” or “nobody”. That user must have proper permission to the directory where you want to save the images. If the web server has write permission to the directory it can save the files without error. PHP normally runs as a module of apache so it runs under the same user. If PHP is run as a CGI, it may use a different user name. In that case that user must have write access to the destination directory.

Generally you should not make the web server the “owner” of the directory. It should instead be part of the “group” that has access to the directory. You cannot change user or group through ftp. You will have to do it with a shell command. If you don’t have shell access, then you have no choice but to use your ftp client to change the permissions of the directory to 777, which isn’t very secure.

sorry but how do I achieve this. This is very sad for me. I am lost

Try moving the call to ob_start() to before the call to session start. That should take care of the first error.

When you upload a file. The file is automatically deposited into a directory set aside for temporary files. When you use a function like move_uploaded_file() you are telling PHP to move the uploaded file out of that temporary directory and into a new destination directory. That destination directory must have the proper permissions set to allow that transfer, or that function will fail.

In UNIX, files and directories have an owner and a group each with it’s own permissions. The owner usually has full permission to the file or directory. The group is a group of users. It usually has lesser access permissions. The other group that has permission to the file or directory is the everyone group. That group contains all other users in the system, including the web server. You must use the command shell to assign the web server user and/or the user that PHP runs as to the group assigned to the destination directory, then give the group write access to the directory. Outside of that, I can only direct you to search for material on UNIX permissions and the UNIX shell. These are essential things to know, if you are going to do application development on any platform.

Thanks a lot. To be very honest with you, I have not messed with my UNIX shell. I use a mac and I am working on a project. I do not want to loose anything t this stage. Do you have tutorial links that could give me a water down explanation on how to solve this?

Regards