here's the code, this one goes well with localhost and it's functioning, however, when i tried it using a web server, it says error uploading file, what do you think is the problem? please help...

$phName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$phSize = $_FILES['userfile']['size'];
$uploadDir ="10.237.102.158/upload/joomla/";
$filePath = $uploadDir . $phName;

echo "<br><br><b>You are required to key-in data in all blank fields.<br> Click the upload button below once you have completed all requirements.<br>If the 

there will be no data to be inputted just type 'NONE'.<br></b>";
echo "<form method='post' enctype='multipart/form-data'>";
echo "<b>Type:</b><br><input type = 'text' name = 'phType' size = 30><br>";
echo "<b>Customer:</b> <br><input type = 'text' name = 'phCustomer' size = 70><br>";
echo "<b>Model:</b> <br><input type = 'text' name = 'phModel' size =50><br>";
$phSubDate = date("F d Y");
echo "<b>Date Due: </b><b><font size = 1>(Please change if necessary)</font></b> <br><input type = 'text' name = 'phDateDue' size =50 value = 

'$phSubDate'><br>";
echo "<b>Status: </b><br><input type = 'text' name = 'phStatus' size =50><br>";
echo "<b>NG Category: </b><br><input type = 'text' name = 'phNG' size =50><br>";
echo "<b>CIR No.:</b> <br><input type = 'text' name = 'phCIR' size =50><br>";
echo "<b>CMR No.: </b><br><input type = 'text' name = 'phCMR' size =50><br>"; 
echo "<input type='hidden' name='MAX_FILE_SIZE' value='100000000'>";
echo "<br>Press browse to select what file to upload:<br> <input name='userfile' type='file' id='userfile'>";
echo "<br><input name='upload' type='submit' class='box' id='upload' value='Upload'></form>";
echo "</form>";
if ($upload == 'Upload')
{
	if ($phType == '' || $phCustomer == '' || $phModel == '' || $phDateDue == '' || $phStatus == '' || $phNG == '' || $phCIR == '' || $phCMR == '') 
	{
		echo "<script>alert('Please complete the information!')</script>";
	}
	else if ($phType != '' || $phCustomer != '' || $phModel != '' || $phDateDue != '' || $phStatus != '' || $phNG != '' || $phCIR != '' || $phCMR != '')
	{								
		$result = move_uploaded_file($tmpName, $filePath);
		
		if (!$result) 
		{
			echo "<script>alert('Error Uploading File!')</script>";
			exit;
		}
		if(!get_magic_quotes_gpc())
		{
			$phName = addslashes($phName);
			$filePath = addslashes($filePath);
		} 
	
		$phSize =  size_hum_read(filesize($filePath)); 

		$result1 = mysql_query("SELECT * FROM sec_ph WHERE phName = '$phName'") or die(mysql_error()); 
		$resultRow1 = mysql_num_rows($result1);
			
		if ($resultRow1 == '0')
		{
			$phDateSubmit = date("F d Y");

			mysql_query("INSERT INTO sec_ph (phName, phType, phCustomer, phModel, phStatus, phNG, phCIR, phCMR, phFlag, 

phDateSubmit,phDateDue, phPath) 
					VALUES ('$phName','$phType', '$phCustomer','$phModel','$phStatus','$phNG','$phCIR','$phCMR', '0', 

'$phDateSumit','$phDateDue', '$uploadDir')") 
						or die(mysql_error());  

			echo "<script>alert('Uploading of file successful')</script>";
		}
		else if ($resultRow1 != '0')
		{
			echo "<script>alert('File already exists! Please try again')</script>";			
		}
	}
}

Note: I am using the Samba server and it has username and password in order to access the said server..

thanks thanks,
need reply asap...^^

Try uploading a simple text file, or using another protocol.
Usually, there isn't a problem with the script but with the method you are uploading it.
You also may wish to contact who runs the server.

Should the IP number be part of the folder path? Or should the path be relative to the script? Like so:

$uploadDir ="upload/joomla/";

This assumes that the script is working in the directory that also contains the sub-directory "upload".

Or are you working on one server, uploading to another? That's above my pay grade but if so, I'm guessing various permission settings are going to be an issue here and I would use PHP ftp functions to move the file (only 'cos I don't know any better!)

It can be relative.
Take a look at some code from Tizag.

$target_path = "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";
} else{
    echo "There was an error uploading the file, please try again!";
}

It looks like you need to access the $_FILES variable to get the filename of the uploaded file, before you can move the temp file to a real file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.