Sorry--I should have read ALL your code... Try taking a look at this manual page:
http://ca.php.net/manual/en/features.file-upload.php It explains how to handle file uploads. Your file name should appear in $_FILES['form_data']. On Sun, 2002-11-17 at 12:54, Marco Tabini wrote: > Seems to me $form_data might be undefined or empty. Could be a problem > related to register_globals if that value is coming from an HTML form. > Try $_REQUEST['form_data'] instead. > > > Marco > > On Sun, 2002-11-17 at 13:58, William Glenn wrote: > > 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: > > > > <html> > > <head> > > <title>Store binary data into SQL Database</title> > > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > > </head> > > > > <body bgcolor="#FFFFFF"> > > <?php > > // 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) > > > > MYSQL_CONNECT("localhost","",""); > > mysql_select_db("ipp_products"); > > $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>"; > > > > MYSQL_CLOSE(); > > 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"> > > <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 > > > > } > > > > ?> > > </body> > > </html> > > > > Any ideas? > > > > Thanks, > > William Glenn > > Import Parts Plus > > http://www.importpartsplus.com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php