
uplodas de imagenes e insert en una bd mysql
Publicado por choty (2 intervenciones) el 14/10/2004 20:01:37
hola, tengo el problema de que el siguiente codigo no me sube una imagen (o eso parece, por que no me inserta nada en la bd)
if ($HTTP_POST_FILES["x_foto"]["tmp_name"] != "none" && $HTTP_POST_FILES["x_foto"]["tmp_name"] != "") {
$fileHandle = fopen($HTTP_POST_FILES["x_foto"]["tmp_name"], "rb");
$fileContent = fread($fileHandle, $HTTP_POST_FILES["x_foto"]["size"]);
$theValue = addslashes($fileContent);
$theValue = "'" . $theValue . "'";
$fieldList["`foto`"] = $theValue;
unlink($HTTP_POST_FILES["x_foto"]["tmp_name"]);
}
// insert into database
$strsql = "INSERT INTO `eventos` (";
$strsql .= implode(",", array_keys($fieldList));
$strsql .= ") VALUES (";
$strsql .= implode(",", array_values($fieldList));
$strsql .= ")";
mysql_query($strsql, $conn) or die(mysql_error());
alguien me puede ayudar y decirme cual puede ser el problema.
desde ya muchas gracias
if ($HTTP_POST_FILES["x_foto"]["tmp_name"] != "none" && $HTTP_POST_FILES["x_foto"]["tmp_name"] != "") {
$fileHandle = fopen($HTTP_POST_FILES["x_foto"]["tmp_name"], "rb");
$fileContent = fread($fileHandle, $HTTP_POST_FILES["x_foto"]["size"]);
$theValue = addslashes($fileContent);
$theValue = "'" . $theValue . "'";
$fieldList["`foto`"] = $theValue;
unlink($HTTP_POST_FILES["x_foto"]["tmp_name"]);
}
// insert into database
$strsql = "INSERT INTO `eventos` (";
$strsql .= implode(",", array_keys($fieldList));
$strsql .= ") VALUES (";
$strsql .= implode(",", array_values($fieldList));
$strsql .= ")";
mysql_query($strsql, $conn) or die(mysql_error());
alguien me puede ayudar y decirme cual puede ser el problema.
desde ya muchas gracias
Valora esta pregunta


0