The file uploads perfectly, but the I can't get the image filename to populate the MySQL database - nor any of the other entries! It looks right to me can anyone tell me what's wrong???
Thanks in advance for your help!
<?php
$file_dir = "/users/rupertbj/domains/rupstar.co.uk/html/images/weblog";
$file_url = "http://www.rupstar.co.uk/images/weblog";
if (isset( $fupload ) )
{
print "path: $fupload<br>\n";
print "name: $fupload_name<br>\n";
print "size: $fupload_size bytes<br>\n";
print "type: $fupload_type<p>\n\n";
if ( $fupload_type == "image/pjpeg" )
{
$db = "weblog";
$link = mysql_connect( "localhost:/users/rupertbj/domains/rupstar.co.uk/sql/mysql.sock", "root" );
if ( !$link ) die( "Couldn't connect to MySQL".mysql_error() );
mysql_select_db( $db, $link ) or die( "Couldn't open $db: ".mysql_error() );
$sql = "INSERT INTO weblogTable VALUES ( '', now(), '$description', '$content', '$fupload_name' )";
mysql_query( $sql, $link );
mysql_close( $link );
copy ( $fupload, "$file_dir/$fupload_name" ) or die ("Couldn't copy");
}
}
?>