Please who could help me with this...
I had my structure in Win32, with Apache, PHP, and MySQL, I had a page
in which I am transfering an image to the database in MySQL using PHP.
But now I am in Apache/Linux/MySQL(FreeBSD) with the same files.
My problem is.. when I try to submit the variables to the php file,
this does not get the binFile, in other words, the
file($_POST['binFile']) does not pass throug the SUBMIT html
statemenT, so it is not transferred to the database, i have tried to
visualize the content of my binFile var, but.. it is EMPTY !!
I write the code here, for you to HELP ME !! thanks all of you
open_db.inc:
<?php
$hndlr=mysql_co nnect("server.c ioh.org.co", "........",
"xxxxxxxx") ;
mysql_select_db ("geobase", $hndlr) or die(mysql_errno () . ": " .
mysql_error() . "<br>");
?>
add.php:
<?php
if ($_POST['action'] == "upload") {
$action=$_POST['action'];
$cod=$_POST['cod'];
//$binFile=$_POST['binFile'];
// tomemos el dato uploaded e insertemoslo en la base de datos
ahora
include "open_db.in c";
print $action."<br>";
print $cod."<br>";
//print "uploading with cod=".strval($c od)." and
codigo_pto=".st rval($codigo_pt o);
if (isset($_POST['binFile']) && $_POST['binFile'] != "none") {
$data = addslashes(frea d(fopen($_POST['binFile'], "r"),
filesize($_POST['binFile'])));
echo "<br>Usando Codigo <B>", $cod,"</B>";
$codigo_pto2 = intval(trim($co d));
$sql = "INSERT INTO imagen ";
$sql .= "(cod_pto, imagen) ";
$sql .= "VALUES ('$codigo_pto2' , '$data')";
$res=mysql_quer y($sql, $hndlr);
echo "<BR>El archivo ha sido transferido exitosamente <BR>a la
Base de Datos GEOBASE.<BR>";
}
mysql_close();
?>
<script type="text/javascript">
window.close()
</script>
<?
} else {
?>
<HTML>
<BODY>
<P><font face="Arial Narrow" size="4">Por favor introduzca la imagen
del punto
de código <B>
<? $codigo_pto=$_G ET['codigo_pto'];
echo $codigo_pto."<- este es el codigo tomado de la URL"; ?>
</B><BR>
a ser guardada en la Base de Datos -<b>GEOBASE</b>- residente en el
servidor MySQL
</font></P>
<FORM METHOD="POST" ACTION="add.php " ENCTYPE="multip art/form-data">
<!--
<INPUT TYPE="hidden" NAME="MAX_FILE_ SIZE" VALUE="1000000" >
-->
<INPUT TYPE="hidden" NAME="action" VALUE="upload">
<INPUT TYPE="hidden" NAME="cod" VALUE="<? echo $codigo_pto; ?>">
<TABLE BORDER="1" bordercolor="#0 00000" bgcolor="#4A959 5">
<TR>
<TD><font color="#CCCCCC" face="Arial Narrow"><b><fon t
color="#E5E5E5" >Imagen
a cargar:</font></b></font> </TD>
<TD><INPUT TYPE="file" NAME="binFile"> </TD>
</TR>
<TR>
<TD COLSPAN="2"><IN PUT TYPE="submit" VALUE="Cargar"> </TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<?php
}
?>
I had my structure in Win32, with Apache, PHP, and MySQL, I had a page
in which I am transfering an image to the database in MySQL using PHP.
But now I am in Apache/Linux/MySQL(FreeBSD) with the same files.
My problem is.. when I try to submit the variables to the php file,
this does not get the binFile, in other words, the
file($_POST['binFile']) does not pass throug the SUBMIT html
statemenT, so it is not transferred to the database, i have tried to
visualize the content of my binFile var, but.. it is EMPTY !!
I write the code here, for you to HELP ME !! thanks all of you
open_db.inc:
<?php
$hndlr=mysql_co nnect("server.c ioh.org.co", "........",
"xxxxxxxx") ;
mysql_select_db ("geobase", $hndlr) or die(mysql_errno () . ": " .
mysql_error() . "<br>");
?>
add.php:
<?php
if ($_POST['action'] == "upload") {
$action=$_POST['action'];
$cod=$_POST['cod'];
//$binFile=$_POST['binFile'];
// tomemos el dato uploaded e insertemoslo en la base de datos
ahora
include "open_db.in c";
print $action."<br>";
print $cod."<br>";
//print "uploading with cod=".strval($c od)." and
codigo_pto=".st rval($codigo_pt o);
if (isset($_POST['binFile']) && $_POST['binFile'] != "none") {
$data = addslashes(frea d(fopen($_POST['binFile'], "r"),
filesize($_POST['binFile'])));
echo "<br>Usando Codigo <B>", $cod,"</B>";
$codigo_pto2 = intval(trim($co d));
$sql = "INSERT INTO imagen ";
$sql .= "(cod_pto, imagen) ";
$sql .= "VALUES ('$codigo_pto2' , '$data')";
$res=mysql_quer y($sql, $hndlr);
echo "<BR>El archivo ha sido transferido exitosamente <BR>a la
Base de Datos GEOBASE.<BR>";
}
mysql_close();
?>
<script type="text/javascript">
window.close()
</script>
<?
} else {
?>
<HTML>
<BODY>
<P><font face="Arial Narrow" size="4">Por favor introduzca la imagen
del punto
de código <B>
<? $codigo_pto=$_G ET['codigo_pto'];
echo $codigo_pto."<- este es el codigo tomado de la URL"; ?>
</B><BR>
a ser guardada en la Base de Datos -<b>GEOBASE</b>- residente en el
servidor MySQL
</font></P>
<FORM METHOD="POST" ACTION="add.php " ENCTYPE="multip art/form-data">
<!--
<INPUT TYPE="hidden" NAME="MAX_FILE_ SIZE" VALUE="1000000" >
-->
<INPUT TYPE="hidden" NAME="action" VALUE="upload">
<INPUT TYPE="hidden" NAME="cod" VALUE="<? echo $codigo_pto; ?>">
<TABLE BORDER="1" bordercolor="#0 00000" bgcolor="#4A959 5">
<TR>
<TD><font color="#CCCCCC" face="Arial Narrow"><b><fon t
color="#E5E5E5" >Imagen
a cargar:</font></b></font> </TD>
<TD><INPUT TYPE="file" NAME="binFile"> </TD>
</TR>
<TR>
<TD COLSPAN="2"><IN PUT TYPE="submit" VALUE="Cargar"> </TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<?php
}
?>
Comment