Hi,

I'm trying to get a script working that will upload an image to a MySQL 
database ... the script seems to be working, in that its not giving errors 
- but it does nothing ... it doesn't add the image to the database at all.

Can someone take a look at this script and let me know where I've gone wrong?

Thanks

Here is the script I'm using:

<?php


if ($submit) {



     MYSQL_CONNECT("localhost","user","pass");
     mysql_select_db("binary_date");

     $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));

     $result=MYSQL_QUERY("INSERT INTO binary_date 
(description,bin_data,filename,filesize,filetype) ".
         "VALUES 
('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");

     $id= mysql_insert_id();
     print "<p>This file has the following Database ID: <b>$id</b>";

     MYSQL_CLOSE();

} else {

     // else show the form to submit new data:
?>

     <form method="post" action="<?php echo $PHP_SELF; ?>" 
enctype="multipart/form-data">
     File Description:<br>
     <input type="text" name="form_description"  size="40">
     <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
     <br>File to upload/store in database:<br>
     <input type="file" name="form_data"  size="40">
     <p><input type="submit" name="submit" value="submit">
     </form>

<?php

}

?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to