PHP File Upload Problem

I have a web server running Windows Server 2003 Enterprise with WAMP Server 2.0. One of the websites using the server requires file upload functionality. I achieved this with the attached code, and it worked fine on my localhost. Then I copied it to the server and it no longer works. When a file is uploaded, there is no error message from PHP, and I was able to return the element of $_FILE for the uploaded file, which looks like this:
Array ( [name] => DEC-2009-11-08-PM.mp3 [type] => audio/mp3 [tmp_name] => C:\WINDOWS\Temp\php32.tmp [error] => 0 [size] => 3753230 )

I have tried changing the tmp directory to several different folders, including one inside the PHP directory within wamp. None of these worked. I have granted full permissions to Users on the server, but still the file does not appear inside the Temp directory.

In the move_uploaded_file part of the script, the else block is used because move_uploaded file fails, but the error element in the array is still 0, meaning a successful upload, and the array still gives a path for the Temp file (which is not there).

Thanks in advance!
<?php
if ($_POST)
	{
		$thedate = explode("/", trim($_POST['date']));
		$thedate = $thedate[2] . "-" . $thedate[1] . "-" . $thedate[0];

		if(move_uploaded_file($_FILES['file']['tmp-name'], "../files/sermons/" . "DEC-" . $thedate . "-" . trim($_POST['service']) . ".mp3"))
		{
		    $csv = file_get_contents("../files/sermons/sermons.csv");
		    $csv .=
		    	"\r\n" . $thedate . "," . 
		    	str_replace(",", "[comma]", trim($_POST['service'])) . "," . 
		   		str_replace(",", "[comma]", trim($_POST['preacher'])) . "," . 
		        str_replace(",", "[comma]", trim($_POST['subject'])) . "," . 
		        str_replace(",", "[comma]", trim($_POST['reading'])) . "," .
		        "DEC-" . $thedate . "-" . trim($_POST['service']) . ".mp3";
		    file_put_contents("../files/sermons/sermons.csv", $csv);
		    echo "File upload was (probably) successful.";
		}
		else
		{
		    echo "There was an error uploading the file, please try again!";
		    print_r($_FILES['file']);
		    echo "../files/sermons/" . "DEC-" . $thedate . "-" . $_POST['service'] . ".mp3";
		    
		}
?> <!-- HTML for the page -->

Open in new window

LVL 2
EliotBallAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
>>if(move_uploaded_file($_FILES['file']['tmp-name'],...

It should be UNDERSCORE: ['temp_name']
NOT hyphen: ['tmp-name']
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EliotBallAuthor Commented:
Can't believe I missed that! You just picked up some easy points there!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.