Error fread() after switching Register Globals Off
| From: | DPCMA Metalito | Date: | Thu, 29 Jan 2004 15:53:12 +0000 |
| Subject: | Error fread() after switching Register Globals Off | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176216@lists.php.net to get a copy of this message | ||
Hi there,
I´m getting this error and I can´t find what the problem is..
Warning: fread(): supplied argument is not a valid stream resource in c:\program files\apache group\apache\htdocs\dpc\modulos\mod_ins_doc.php on line 13
I´ve got a form that calls a module to insert data. IT WAS WORKING before I switched the Register Globals to Off value. I made the proper chages to recieve variables, but i cannot make it work. Here is the code of the insert module.
<?
$dbhost="localhost";
$dbusuario="user";
$dbpassword="password";
$db="database";
$conexion = mysql_connect($dbhost,$dbusuario,$dbpassword);
mysql_select_db($db,$conexion);
$farchivo=$_POST['farchivo'];
$binary = addslashes (fread(fopen($farchivo, "rb"), filesize($farchivo)));
$nombre=$_POST['fnombre'];
$descripcion=$_POST['fdescripcion'];
$insert_data = "INSERT INTO
documentos (id, nombre, descripcion, fichero, nomfichero, tamfichero, tipofichero)
VALUES ('', '$nombre','$descripcion','$binary', '$farchivo_name', '$farchivo_size', '$farchivo_type')";
mysql_query($insert_data,$conexion) or die("Couldn't insert data.");
header("Location: ../index.php?sec=doc0");
?>
The code of the form is correct. This is the name of the input fields.
<INPUT TYPE=\"text\" NAME=\"fnombre\" SIZE=\"20\" CLASS=\"identificationfield\">";
<TEXTAREA name=\"fdescripcion\" cols=\"40\" rows=\"3\" CLASS=\"identificationfield\"></textarea>";
<INPUT type=\"file\" name=\"farchivo\" size=\"30\" CLASS=\"identificationfield\">";
Any ideas?
Thank You.
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail