RE: [PHP-DB] File input from form not detected
| From: | Dewi Wahyuni | Date: | Mon, 02 Jun 2003 01:53:34 +0000 |
| Subject: | RE: [PHP-DB] File input from form not detected | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-28199@lists.php.net to get a copy of this message | ||
Hi everyone
I changed the code a bit. Using the file tmp now.
Here's the code and the error (still error but less)
Thanks for the help
upload.php
-----------------------------------------
<?
phpinfo();
echo $_POST['userfile']['tmp'];
if (is_uploaded_file($_POST['userfile']))
copy($userfile, $HTTP_POST_FILES['userfile']['name']);
else echo "error. File: $userfile.";
$filename=$HTTP_POST_FILES['userfile']['name'];
$fd = fopen ($_FILES["userfile"]["tmp_name"], "rb");
$contents = fread ($fd, filesize($filename));
fclose($fd);
$escaped_contents=mysql_escape_string($contents);
// Connecting, selecting database
$link = mysql_connect("localhost", "","");
mysql_select_db("bus8646",$db);
// Performing SQL query; assuming that the "picture" is a BLOB field
$query = "UPDATE studentpart SET pic='$escaped_contents' WHERE
loginname='lulu'";
$result = mysql_query($query)
or die("Query failed");
// Closing connection
mysql_close($link);
?>
error code
------------------------------------------
error. File: /tmp/phpObl8LE.
Warning: filesize() [function.filesize]: Stat failed for b_about.gif (errno=2 - No such file or
directory) in /home/bus8646/www/tryout/upload.php on line 10
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in
/home/bus8646/www/tryout/upload.php on line 15
Query failed
____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005