I am trying to load some jpgs etc. into mysql but my code does not seem to want to communicate with the database. I'm not even getting any (database, parse or syntax) errors. There has to be a simple explanation for this. Here is my code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Listing 13.1 Opening a Connection to a Database</title> </head> <body> <?php if ( ! empty( $_REQUEST['strDesc'] )&& ! empty( $_REQUEST['fileUpload'] ) ){ // check user input here! $dberror = ""; $ret = add_to_database( $_REQUEST['strDesc'], $_REQUEST['fileUpload'], $_REQUEST['fileUpload_type'], $_REQUEST['fileUpload_name'], $_REQUEST['fileUpload_size'], $dberror ); if ( ! $ret ) { print "Error: $dberror<br />\n"; } else { print "Thank you very much<br />\n"; } } else { write_form(); } function add_to_database( $strDesc, $fileUpload, $fileUpload_name, $fileUpload_size, $fileUpload_type, &$dberror ) { $strDesc = mysql_real_escape_string( $strDesc ); $fileUpload = mysql_real_escape_string( $fileUpload ); $fileUpload_name = mysql_real_escape_string( $fileUpload_name ); $fileUpload_size = mysql_real_escape_string( $fileUpload_size ); $fileUpload_type = mysql_real_escape_string( $fileUpload_type ); $fileHandle = fopen($fileUpload, "r"); $fileContent = fread($fileHandle, $fileUpload_size); $fileContent = addslashes($fileContent); $link = mysql_pconnect( "localhost", "", "" ); if ( ! $link ) { $dberror = mysql_error(); return false; } if ( ! mysql_select_db( "myfiles", $link ) ) { $dberror = mysql_error(); return false; } $query = "INSERT INTO myblobs( strDesc, fileUpload, fileUpload_name, fileUpload_size, fileUpload_type ) values('$strDesc', '$fileUpload', '$fileUpload_name', '$fileUpload_size', '$fileUpload_type' )"; if ( ! mysql_query( $query, $link ) ) { $dberror = mysql_error(); return false; } echo "<h1>File Uploaded</h1>"; echo "The details of the uploaded file are shown below:<br><br>"; echo "<b>File name:</b> $fileUpload_name <br>"; echo "<b>File type:</b> $fileUpload_type <br>"; echo "<b>File size:</b> $fileUpload_size <br>"; echo "<b>Uploaded to:</b> $fileUpload <br><br>"; echo "<a href='uploadfile.php'>Add Another File</a>"; return true; } function write_form() { print ' <form method="post" enctype="multipart/form-data" name="frmUploadFile" action="{' . $_SERVER['PHP_SELF'] . '}"> <p><input type="text" name="strDesc" size="20" maxlength="50" /> file Description:</p> <p><input type="file" name="fileUpload" size="20" /> Choose a file</p> <input type="submit" value="Upload this file" name="Submit" /></p> </form> </FORM> '; } ?> </form> </BODY> </HTML> ===== Patrick Roane Web design and development www.franklin-band.com Fox River Grove, Il. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php