Hi,

I'm attempting to store jpg images into a MySQL DB using PHP.  I've found a 
few sample scripts that should do this for me, however, they don't seem to 
be working.  Could someone take a look at this and see if you notice any 
problems?

Thanks
-Tim

<?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 {


?>

     <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

}

?>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to