Hi,
I am going crazy as to why this does not work. I am trying a different approach than my last post. I am trying to upload 2 files from my form to my webserver and the send the file directory to the database.
Is this code correct and that i have a problem with my webserver permission , or have i done something wrong.
Below is the code and the error message.
<?
$uploadDir = '/home/****/*****';
if(isset($_POST['upload']))
{
$fileName = $_FILES['mugimage1']['fname'];
$tmpName = $_FILES['mugimage1']['tmp_name'];
$fileSize = $_FILES['mugimage1']['size'];
$fileType = $_FILES['mugimage1']['type'];
$fileName2 = $_FILES['mugimage2']['fname'];
$tmpName2 = $_FILES['mugimage2']['tmp_name'];
$fileSize2 = $_FILES['mugimage2']['size'];
$fileType2 = $_FILES['mugimage2']['type'];
$cust_name = $_POST['cust_name'];
$cust_email = $_POST['cust_email'];
$mugtext = $_POST['mugtext'];
$textcolour = $_POST['textcolour'];
$ebayid = $_POST['ebayid'];
$filepath = $uploadDir . $fileName;
[color=red]$result = move_uploaded_file($tmpName,$filePath);
$result = move_uploaded_file($tmpName2,$filePath);[/color]
if (!$result) {
echo "Error Uploading File";
exit;
}
$dbh=mysql_connect ("localhost", "user", "pass") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("******");
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
$filePath = addslashes($filePath);
$fileName2 = addslashes($fileName2);
$filePath = addslashes($filePath);
}
////////////////////////////////////////////////
////////////////////////////////////////////////
///////DO NOT CHANGE////////////////////////////
////////////////////////////////////////////////
$query = "INSERT INTO upload (fname, size, type, fname2, size2, type2, cust_name, cust_email, mugtext, textcolour, ebayid, path ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$fileName2', '$fileSize2', '$fileType2', '$cust_name', '$cust_email', '$mugtext', '$textcolour', '$ebayid', '$filePath')";
mysql_query($query) or die('Error, query failed');
mysql_close($dbh);
echo "<br>Files Uploaded<br>";
}
?>
ERROR CODE:
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phporlAsc' to '' in /**//***/mugorders.php on line 32
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpV50oyf' to '' in /**//****/mugorders.php on line 33
Error Uploading File
Thanks for you help.