note 6636 deleted from features.file-upload by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 20:31:12 +0000 |
| Subject: | note 6636 deleted from features.file-upload by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25331@lists.php.net to get a copy of this message | ||
RE: uploading in database. PHP creates a tempfile which you can fopen(). Read the entire file into a
$var and insert it into a database. In case of mysql you would do:
<PRE>
// for $userfile, see manual-example
$fd = fopen($userfile, "r");
$x = fread($fd, filesize($userfile));
$y = AddSlashes($x);
$mysql_query('INSERT INTO tbl VALUES(\''.$y.'\')');
</PRE>