Problem with viewing uploaded file

hello there…
i’m a newbie in PHP, so i appreciate it much if anyone can help me with my system…

i have a form with upload file function…
uploaded file will be saved into C:/xampp/htdocs/onlineSystem/admin/attachments/…it’s file name will be saved in table ‘update’ in MySQL (this is to be used when displaying the uploaded file –> using a href)
the problem is that, when user clicks on the file name, the system looks at ‘admin’ folder, not the ‘attachments’ folder…

i think the problem is in the MySQL, because i only save it’s file name, not directory… (please correct me if i’m wrong…)

help me, anyone?

updateProjStat.php

<form name=“updateForm” action=“updateProjStatAction.php” enctype=“multipart/form-data” method=“post”>
<table>
<?php
echo “<tr>”;
echo “<td>Attach File</td>”;
echo “<td><input name=\“file\” type=\“file\” id=\“file\”></td>”;
echo “<tr>”;
?>
</table>
<?php
<input type=\“submit\” name=\“submitProjStat\” value=\“Submit Update\”/>
?>
</form>

updateProjStatAction.php

<?php
if(isset($_POST[‘submitProjStat’]))
{
$target = “C:/xampp/htdocs/onlineSystem/admin/attachments/”;
$target = $target . basename( $_FILES[‘file’][‘name’]);

$fileName=($_FILES[‘file’][‘name’]);

if (file_exists(“C:/xampp/htdocs/onlineSystem/admin/attachments/” . $_FILES[‘file’][‘name’]))
{
?> <script type=“text/javascript”>
alert(“Error
File already exists”);
history.go(-1);
</script>
<?php
}
else
{
move_uploaded_file($_FILES[‘file’][‘tmp_name’], $target);
$fileName = addslashes($fileName);
mysql_query(“INSERT INTO update (fileName) VALUES (‘$fileName’)”) or die(mysql_error());
}
}
?>

updateLog.php

<?php
$qry2=mysql_query(“SELECT * FROM update”);
$num2=mysql_num_rows($qry2);

if ($num2==0)
{   echo "&lt;p&gt;There is no update available for this project&lt;/p&gt;";  }

else if ($num2&gt;0)
{   echo "&lt;table&gt;";
	echo "&lt;tr&gt;&lt;th&gt;Attachment(s)&lt;/th&gt;&lt;/tr&gt;";
while ($row2=mysql_fetch_array($qry2))
{   echo "&lt;tr&gt;";
	echo "&lt;td class=\\"tdCenter tdFont tdColor\\"&gt;&lt;a href=\\"$row2[fileName]\\"&gt;$row2[fileName]&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";
	echo "&lt;/tr&gt;";
}
echo "&lt;/table&gt;";
}

?>

What is the ouput to the screen if you echo the value of $fileName just above this line?

mysql_query("INSERT INTO `update` (fileName) VALUES ('$fileName')") or die(mysql_error());