I'm trying to upload .js files onto my sever. This is the code:

	<title>Add Ubiquity Command</title>
		<form action="add_ubiquity_cmd.php" method="post" enctype="multipart/form-data">
			Name: <input type="text" name="name" /><br />
			Description: <textarea rows="8" cols="30" name="description"></textarea><br />
			JS File: <input type="file" name="file"><br />
			<input type="submit" value="Add Command" /><br/>
				$con = mysql_connect("localhost", "usr", "pass");  
				if($_FILES["file"]["error"] > 0)
					echo "Error: ".$_FILES["file"]["error"];
				elseif($_FILES["file"]["type"] != "application/x-javascript")
					echo "Error: file not a Javascript file";
					echo "Error: filename already being used.";
						$error = error_get_last();
						echo "Error uploading file:<br />Type:".$error["type"]."<br />Message:".$error["message"];
						echo "File uploaded<br />";
						$sql = "INSERT INTO ubiquity_cmds (name,description,js_filename) VALUES(".$_POST["name"].",".$_POST["description"].",".$_FILES["file"]["name"].")";
							echo "Command added";
							echo "Error adding command: ".mysql_error();

I get this error:

Error uploading file:
Message:move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpuveovn' to '/ubiquity/cmd_echo.js'

Anyone know what a possible problem might be?

My first guess would be that you don't have write permission on the destination directory.

Try turning on the debug messages by putting this at the top of your page:

ini_set('display_errors', true);

See if that produces a more helpful error message.

may be permission error of destination directory

I think I found my problem. For some reason, doing /ubiquity/ doesn't work. I'm under the impression that / would be my public_html directory, and so /ubiquity/ would be public_html/ubiquity/. Anyway, I changed it to ../ubiquity/ (the folder I'm in is also located in public_html), and I don't get an error with the file move.

On a Linux server, prefixing any path with / will make it start at the root directory.

So your /ubiquity/ path would look for a folder called ubiquity directly under the root.

This is different for URL's, where / will have the browser start at the web root.
Like, for example, if you had an <a> href /page.php in a page at www.example.com/path/to/page.html , it would send you to www.example.com/page.php .