got a problem here people.
What I want to do is upload a file and store its name in a database.
For some reason I cant.

I can upload the file fine but can't pass it's name to the mysql DB.
Any ideas:

Upload form:
<?
require( "../Cart.php");
Brand();
DBInfo();


echo "<b>You can now upload a picture...</b><br><br>";
echo  "<form enctype='multipart/form-data' action='uploadItem.php'
method=post>";
echo  "<INPUT TYPE='hidden' name='MAX_FILE_SIZE' value='25000'>";
echo  "<INPUT TYPE='hidden' name='ID' value='$II'>";
echo  "<INPUT name='userfile' type='file'>";
blueFont( "Arial", "Send this file: ");
echo  "<INPUT TYPE='submit' VALUE='Send File'></form>";

echo "<p><b>This file MUST be a JPEG (jpg) image.</b>";

//adminFooter($Relative);
?>

Process the form:
<?
require("../Cart.php");
Root();
DBinfo();

mysql_connect("$DBHost","$DBUser","$DBPass");
$UploadURL = "../images/";
if ($usefile=="none")
{
echo "Error: no file uploaded";
exit;
}
//Connect to DB
$mysql = mysql_connect("$DBHost","$DBUser","$DBPass");
if(!$mysql)
{
echo "Cannot connect to database.";
exit;
}

mysql_query("INSERT INTO Items (ImageName) WHERE ItemID = '$II'
VALUE('test')");

$upfile = "$UploadURL".$userfile_name;

if ( !copy($userfile, $upfile))
{
echo "Error: Could not move file into directory";
exit;
}
?> 

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to