I have the following code that inserts the image name into a folder on my server. I also want it to insert just the name without the .gif but I can't get it to work. Any ideas?
<form name="form1" method="post" action="" enctype="multipart/form-data">
<input type="file" name="imagefile">
<input type="submit" name="Submit" value="Submit">
<?
$connection=mysql_connect("**","","") or die("Could not connect to the database server");
$db= mysql_select_db("**",$connection) or die ("Unable to select database.");
if(isset( $Submit ))
{
if ($_FILES['imagefile']['type'] == "image/gif"){
copy ($_FILES['imagefile']['tmp_name'], "Images/".$_FILES['imagefile']['name'])
or die ("Could not copy");
$SQL = "INSERT INTO TShirts (image) VALUES ('$image')";
$Result = mysql_query($SQL) or die(mysql_error());
echo "<br>";
echo "Name: ".$FILES['imagefile']['name']."<br>";
echo "Size: ".$FILES['imagefile']['size']."<br>";
echo "Type: ".$_FILES['imagefile']['type']."<br>";
echo "Copy Done....";
}
else {
echo "";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")";
}
}
?> </form>