Image Upload Code Not Working Within Larger Script

Hello,

I’m developing a small network for my friends and I online. I was wondering if someone could help me figure out why the image upload code does not work in the following script, meaning it does not upload any image into the uploads folder specified. This code does work on its own however, but it does not work when put into the larger script.

Any help would be gratefully recieved. Many thanks…
[php]<?php

// Include the essential files required for the profile, whether it is displayed or not…
include (‘includes/header.html’);

// Connect to the database.
require_once(‘mysqli_connect.php’);

// Which user are we looking at?

if (isset($_GET[‘user_id’]) && is_numeric($_GET[‘user_id’])) { // Does the ID exist in the $_GET array?

$id = (int) $_GET['user_id'];

if ($id > 0) { // If the ID is greater than 1, then run the query.

	$q = "SELECT * FROM users WHERE user_id='$id' LIMIT 1";
	$r = mysqli_query($dbc, $q);
	
}


	if (mysqli_num_rows($r) == 1) { // If the query brings back the row, then store it in the row array.
	
		$row = mysqli_fetch_array ($r, MYSQLI_ASSOC);
	
		// Make sure the first name and last name are uppercase when displayed...
		$fn = $row['first_name']; $fn = ucfirst($fn);
		$ln = $row['last_name']; $ln = ucfirst($ln);
	
	}

?>

	</div>
    
    
	<!-- The div for content -->
	<div class="content">
	
    <!-- The div for middle -->
	<div class="middle">
    
    

	
    
    <!-- The div for info -->
	<div class="info">
    
	
	

	<?php if (isset($_SESSION['user_id']) == $id) 
	
	// Check that a file was uploaded...
	
	if (is_uploaded_file($_FILES['image']['tmp_name'])) {
		
		// Create a temporary file name...
		
		$temp = 'uploads/' . md5($_FILES['image']['name']);
		
		// Move the file over...
		
		if (move_uploaded_file($_FILES['image']['tmp_name'], $temp)) {
			
			$i = $_FILES['image']['name'];
			
		} else {
			
		}
		
	} else {
		
	}
	
	echo '
		
	

	<form enctype="multipart/form-data" action="profile.php" method="post">
	<input type="hidden" name="MAX_FILE_SIZE" value="524288" />
	<p>Upload your photograph!&nbsp; &nbsp;<input type="file" name="image" />
	<input type="submit" name="submit" value="Upload"/>
	<input type="hidden" name="submitted" value="TRUE"/>
	
	'
	
	?>
	
    <!-- End info -->
	</div>
	
    <!-- End middle -->
	</div>
    
    <!-- End content -->
	</div>
    
    <!-- End wrapper -->
	</div>
    
    <?php ; } ?>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service