PHP Upload Script not Moving File! Please Help

Hey ppl its my first post here so here goes…

Me and two of my friends are creating a website called Souljaz Studios and Im in the middle of making the Image Upload script and Im having problems with it without errors. Heres my code…

[php]

function upload_image()
{
// chmod’d to eliminate any permission errors…
chmod("/gallery/", 777);

if($_FILES["file"]["error"] > 0)
{
	print "Error: " . $_FILES["file"]["error"] . "<br>";
}
else
{

            // Display the $_FILES array. Everything checks out
	print_r(var_dump($_FILES));
	
	print "</br></br>";
	
	print "Upload: " . $_FILES["file"]["name"] . "<br>";
	print "Type: " . $_FILES["file"]["type"] . "<br>";
 	print "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
	print "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
	
	if(file_exists("/gallery/" . $_FILES["file"]["name"]))
	{
		print $_FILES["file"]["name"] . " already exists. ";
	}
	else
	{
		move_uploaded_file($_FILES["file"]["tmp_name"], "/gallery/" . $_FILES["file"]["name"]);
		print "Image uploaded successfully!";
	}
}

if(is_uploaded_file($_FILES["file"]["tmp_name"]))
{
	print "</br>File Uploaded"; 
}
else
{
	print "</br>File NOT uploaded";
}

}

[/php]

The file gets uploaded to the windows/temp folder but it wont successfully move it to the /gallery/ folder within wwwroot/

Im running IIS and the script is throwing no errors.

Any thoughts? Thanks

Sorry forgot the show you the upload_image.php file…

[php]

<?php include("inc/functions.inc.php"); if(isset($_FILES["file"])) upload_image(); ?>

Image

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service