a browse and submit button when pick the image and submit , the image name goes to my SQL table and the image it self that the customer pick it copied to my "upload" folder :(
my problem is that i only see the image name , so my issue is that i can't upload that image to a Folder :S
the code is :
<?php require_once('Connections/dalilack.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO packages (packageTitle, packageDescription, packageGraphic) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['packageTitle'], "text"),
GetSQLValueString($_POST['packageDescription'], "text"),
GetSQLValueString($_POST['packageGraphic'], "text"));
mysql_select_db($database_dalilack, $dalilack);
$Result1 = mysql_query($insertSQL, $dalilack) or die(mysql_error());
$target_path = "upload/".$_FILES['packageGraphic']['name'];
move_uploaded_file($_FILES['packageGraphic']['tmp_name'],$target_path);
$insertGoTo = "marketList.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_dalilack, $dalilack);
$query_product = "SELECT packageId, packageTitle, packageDescription, packageGraphic FROM packages";
$product = mysql_query($query_product, $dalilack) or die(mysql_error());
$row_product = mysql_fetch_assoc($product);
$totalRows_product = mysql_num_rows($product);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>Portfolio</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="stylesheets/screen.css" type="text/css" rel="stylesheet" media="screen,projection" />
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/framework.js"></script>
<!--[if lt IE 7]>
<link href="stylesheets/screen-ie6.css" type="text/css" rel="stylesheet" media="screen,projection" />
<![endif]-->
</head>
<body>
<div class="main">
<div class="header_full">
<div class="header">
<div class="twitter"><a href="index.html"><img src="images/twitter.gif" width="38" height="35" border="0" alt="logo" /></a><span>Follow us on Twitter</span></div>
<div class="top_menu"><a href="#">Email</a> | <a href="#">Client Login</a></div>
<div class="clr"></div>
<div class="logo"><a href="index.html"><img src="images/logo2.png" width="249" height="71" border="0" alt="logo" /></a></div>
<div class="menu">
<ul>
<li><a href="index.html"><span>home</span></a></li>
<li><a href="portfolio.html" class="active"><span>portfolio</span></a></li>
<li><a href="about.html"><span>about me</span></a></li>
<li><a href="contact.html"><span>contact me</span></a></li>
</ul>
</div>
<div class="clr"></div>
</div>
</div>
<div class="body">
<div class="block_box">
<div class="block_box_t">
<div class="block_box_b">
<h1 class="about">E-Market : Click then Post !!</h1>
<div id="container">
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">PackageTitle:</td>
<td><input type="text" name="packageTitle" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">PackageDescription:</td>
<td><input type="text" name="packageDescription" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">PackageGraphic:</td>
<td><input type="file" name="packageGraphic" id="upload" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Insert record" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p>
</p>
</div>
<div class="clr"></div>
</div>
</div>
</div>
</div>
<div class="footer">
<div class="footer_resize">
<p class="leftt"><a href="index.html"><img src="images/logo_f.png" alt="picture" width="249" height="71" border="0" /></a></p>
<p class="rightt">© Copyright Dalilack.com. <a href="http://dalilack.com/" class="no_border">dalilack.com</a>. All Rights Reserved</p>
<div class="clr"></div>
</div>
</div>
<div class="clr"></div>
</div>
<p> </p>
</body>
</html>
<?php
mysql_free_result($product);
?>
thank you