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.

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

Reply via email to