Upload.php no longer working

I have written code to upload a file using a form and the uploader script…
This code was working great for WEEKS until yesterday morning and now it has a problem loading the files.
I’m at a total loss since nothing has changed in the code or on the server.
The files are uploaded to a directory /var/tmp/uploads which is chmod 777 and chown root root.
The permissions on the php scripts is 755.
I am running PHP version 5.2.4
I have checked the php.ini and the file_uploads is set to ON and the size is 2M. The files are much smaller than this…
I’m running on a Linux Ubuntu 5.12…

The code is as follows:

<!--<form enctype="multipart/form-data" action="uploader.php" method="POST">-->
<form method="post" name="form1" id="form1" enctype="multipart/form-data" action="uploader.php">
<table align=center>
		<td>Client: </td>
			if($db == '10.0.0.xx'){
				@mysql_select_db(xxx) or die( "Unable to select database");
			if($db == '10.0.0.xx'){
				@mysql_select_db(xxx) or die( "Unable to select database");
			if($db == '10.0.0.xx'){
				@mysql_select_db(xxx) or die( "Unable to select database");
			$query="SELECT * FROM Client_table WHERE ClientBranch = '$branch' ORDER BY ClientName";
			echo '<select name="ClientName">';
			while($nt=mysql_fetch_array($result)) {  // Array or records stored in $nt
				echo '<option value="'.$nt[ClientName].'|'.$nt[ClientKey].'|'.$nt[AccountNo].'">' .$nt['ClientName'].' - '.$nt[AccountNo].'</option>';
			echo '</select>'; // closing list
		<td><input type="hidden" name="MAX_FILE_SIZE" value="100000" />
			Choose a file to upload: </td>
			<td><input name="uploadedfile" type="file" /></td>
		<td> Email for Error Report</td>
		<td><input type=text name=error_mail value="<? echo $blank ?>" ></td>
		<td colspan=2> &nbsp </td>
		<input type="hidden" name="branch" value="<? echo $branch ?>">
		<input type="hidden" name="db" value="<? echo $db ?>">
		<input type="hidden" name="login" value="<? echo $login ?>">
		<input type="hidden" name="we_date" value="<? echo $we_date ?>">
		<td colspan=2 align=center><input type="submit" value="Upload File" /> </td>




$client = explode("|", $_REQUEST['ClientName']);


$target_path = "/var/tmp/uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    //echo "The file ".  basename( $_FILES['uploadedfile']['name']).
    //" has been uploaded";
	<script language="JavaScript">
		window.location.href='check_import_rules.php?branch=<? echo $branch?>&db=<? echo $db?>&login=<? echo $login?>&client_key=<? echo $client_key?>&client_name=<? echo $client_name?>&client_acno=<?echo $client_acno?>&filename=<? echo $filename?>&weekending_date=<? echo $weekending_date?>&error_mail=<? echo $error_mail?>';
} else{
    echo "There was an error uploading the file, please try again!";


As I said, this code has been working for weeks and suddenly started echo-ing the “There was a problem uploading the file, please try again!” error.
Can anyone spot what is causing this because I’m totally stuck!


Note : The scripts are working for file types except Excel Spread Sheets.
This is a huge problem since the users will be uploading spread sheets only.
Until yesterday mid-morning, the scripts were uploading spread sheets but now I only get the error that the file could not be uploaded.
I believe that there is an issue moving it from the tmp name to the target path but I have no idea why this would be.