Will W wrote:

Can anyone tell me how to insert a file, say a .doc, .txt or a .rtf file into a table from an upload form??

How about just this:

$query = "INSERT INTO Table (orig_name, size, mime_type, data) VALUES ('{$_FILES['userfile']['name']}', '{$_FILES['userfile']['size']}', '{$_FILES['userfile']['type']}',LOAD_FILE('{$_FILES['userfile']['tmp_name']}'))";

Adapt to your needs. No need for PHP to read the file when you can just let MySQL do it. :)

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to