Hi Guys,
Why won't the basename() work in the example below?
I have a form (below is a snippet from the form)
<font face=Verdana, Arial size=2 color=red><b>Picture: (Artwork)</b></font><br>
<input name=art_pic type=file size=50><br><br>
When the form is submitted the following php page is executed:
<?
echo "<img src=\"logo_melbcent_small.gif\" align=right>";
echo "<font face=Verdana, Arial size=4><b>Devil's Devine Administration Area</b></font>";
echo "<hr>";
echo "<font face=Verdana, Arial size=2><b>Results:</b></font><br>";
echo "<hr><br>";
if (!$title)
{
echo "<font face=Verdana, Arial color=red size=2><b>WARNING!</b></font><font face=Verdana, Arial size=2> You have not entered a title:</font><br>";
echo "<font face=Verdana, Arial size=2>Please go back and try again.</font>";
exit;
}
$active = addslashes($active);
$art_pic = basename ($art_pic);
@ $db = mysql_pconnect('localhost', '', '');
if (!$db)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("devilsdivine");
$query = "insert into biography(bio_id, artist_id, title, art_pic, medium, size, price, active)
values(NULL,'$artist_id','$title','$art_pic','$medium','$size','$price','$active')";
$result=mysql_query($query);
if($result)
echo "<font face=Verdana, Arial size=2>Your information was successfully inserted into the database.</font><br>";
echo "<br><a href=\"members_only_1.php\">Back to main page</a>";
?>
Every field from the form gets passed to the DB successfully except instead of passing the basename of the files path it is inserting the entire path.
Any ideas?
Cheers,
micmac