hi everyone
the below code pretty much works perfectly it allows u to select a file, uploads it, puts the address in the database table and moves the file to the new location. My problem is with the link at the botom of the page. I am trying to link to the newly uploaded file in its new location using the file path that has been stored in the database but the link does not open in the browser window and is effectivly dead. I can however right click and save the image. can anyone see why the link doesnt work?
thanks
<?PHP
require ($_SERVER['DOCUMENT_ROOT']. '/root/includes/header.php');
include ('c:/web/db_connect.php');
if (isset ($_POST['confirm']))
{
if ( $_FILES['image'] ['name'] != "")
{
$uploadedFile = $_FILES['image']['tmp_name'];
$newFile = $GLOBALS['imagepath'].$_FILES['image']['name'];
move_uploaded_file($uploadedFile, $newFile); //this works and the file moves to the server
echo ($newFile);
$query = "UPDATE settings SET masthead = '$newFile' WHERE clubid = 1 ";
mysql_query($query);
}
}
?>
<tr>
<td width="780" colspan="4" border="1" align="left" bgcolor="#FFFFFF">
<form action="addmasthead.php" method="post" enctype="multipart/form-data">
<input type="file" name="image" size="45">
<br>
<input type= "submit" name= "confirm" value="Upload file">
</form>
<?php
if ($_FILES['image'] ['name'] != "") //if file selected show success else error
{ echo ('Your Masthead image has been updated successfully');}
else { echo (" You need to select an image");}
$mastquery = "SELECT masthead FROM settings where clubid = 1";
$result = mysql_query($mastquery);
$mastquery = mysql_fetch_assoc($result);
$mastquery = $mastquery['masthead'];
echo ($mastquery);
?>
<a href="<?php echo ($mastquery); ?> ">Click here to view the file</a>
</td>
</tr>
<?PHP require ('C:/web/root/includes/footer.php');?>