RE: File input from form not detected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux