Hey all, need some quick help. I have some code I was trying to get to work but I keep 
getting this error: 
Warning: fopen("", "rb") - Success in /home/digital/public_html/upload_test.php3 on 
line 18

Warning: stat failed for (errno=2 - No such file or directory) in 
/home/digital/public_html/upload_test.php3 on line 18

Warning: fread(): supplied argument is not a valid File-Handle resource in 
/home/digital/public_html/upload_test.php3 on line 18

Here's my code:

<title>Store binary data into SQL Database</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<body bgcolor="#FFFFFF">
// code that will be executed if the form has been submitted:

if ($submit) {

// connect to the database
    // (you may have to adjust the hostname,username or password)

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

    $result=MYSQL_QUERY("INSERT INTO display_images (description,data) ".
        "VALUES ('$form_description','$form_data')");

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

echo "$data";
} 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">
  File to upload/store in database:<br>
  <input type="file" name="form_data"  size="40">
    <input type="submit" name="submit" value="submit">



Any ideas?

William Glenn
Import Parts Plus

Reply via email to