#21908 [Com]: File upload problems beginning in 4.3.0

From: Date: Sat, 10 May 2003 17:40:36 +0000
Subject: #21908 [Com]: File upload problems beginning in 4.3.0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-39417@lists.php.net to get a copy of this message
ID: 21908 Comment by: androbtech at monosalvaje dot com Reported By: fn at panix dot com Status: Bogus Bug Type: *General Issues Operating System: NetBSD-1.5.2 PHP Version: 4.3.0 New Comment: Me again , I forgot to add something, the function is_uploaded_file() does not work, I don;t know why and in older versions this script used to work 100% perfect and NOW -100% wrong Previous Comments: ------------------------------------------------------------------------ [2003-05-10 12:36:37] androbtech at monosalvaje dot com I got the following code and Im running PHP 4.3.0 For MAC OS X, the last Version is not avilable... <?php /* funciones para fotos */ if($_GET["x"] == "despues") { ?> <form method="post" enctype="multipart/form-data" action="ja.php?x=ahora"> <table width="440" height="412" border="0" cellpadding="0" cellspacing="8"> <tr> <td height="187" valign="top"> <span class=submenu>Para poder subir imagenes a la base de datos le pedimos lo siguiente:</span><br><br> <table width="341" border="1" align="center" cellpadding="0" cellspacing="8" bordercolor="#FFFFFF" bgcolor="#003333" class="texto"> <tr> <td colspan="2">Datos:</td> </tr> <tr> <td width="45" align="right">Nombre:</td> <td width="125"><input name="nombre" type="text" class="textbox"></td> </tr> <tr> <td align="right">Juego:</td> <td><input name="juego" type="text" class="textbox"></td> </tr> <tr> <td align="right">Consola:</td> <td> <select name="consola" class="textbox"> <option value="GC">Nintendo GameCube</option> <option value="N64">Nintendo 64</option> <option value="PS2">Playstation 2</option> <option value="PS">Playstation</option> <option value="XBOX">XBOX</option> </select> </td> </tr> <tr> <td align="right">Imagen:</td> <td><input type="file" name="imagen" class="filebox"></td> </tr> </table> <center><input type=submit name=submit value="Subir imagen" class="subbox"></center> </td> </tr> </table> </form> <?php } elseif ($_GET["x"] == "ahora") { require("php-bin/seguridad/panel/configuracion.php"); $conn = mysql_connect($db_servidor,$db_usuario,$db_clave); if(is_uploaded_file($_FILES["imagen"])) { echo("imagen subida"); $imagen = fopen($_FILES["imagen"], "r"); $datos = fread($imagen, filesize($_FILES["imagen"])); $datos = addslashes($datos); } $query = "INSERT INTO thumbs VALUES ('','$_POST[juego]','$_POST[consola]','$_POST[nombre]','".$_FILES['imagen']['type']."','','$datos')"; if(mysql_db_query($db_nombre,$query,$conn)) { $err = "0"; } else { $err = "3"; } $conn = mysql_close($conn); ?> todo subido, todo bien. <?php } else { echo("ninguna opcion"); } ?> ------------------------------------------------------------------------ [2003-02-04 15:19:58] iliaa@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. based on user comments the code works fine, the errors were due to configuration issues or misunderstanding of the docs. ------------------------------------------------------------------------ [2003-02-04 15:14:40] evatckovacs at netscape dot net thank you. i am dumb. i saw the FILES stuff and blew it off as being irrelevant, for whatever reason. thank you again. ------------------------------------------------------------------------ [2003-02-04 11:48:38] michael dot mauch at gmx dot de For file uploads it's $_FILES, not $_POST. Please read <http://www.php.net/manual/en/features.file-upload.php>. ------------------------------------------------------------------------ [2003-02-04 10:41:43] evatckovacs at netscape dot net hi - i set the file upload dir but the problem is still happening and seems to be a little different. my filename variable does not get passed over in the post when in the same php program. i have not tried an html that calls a standalone php yet, but the $afile variable below holds nothing when you output contents while $crud does. maybe $_POST is not valid for filenames? or? should i just write email directly to someone? i promise i've looked at all the docs and grovelled for help locally. thank you. evatc ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/21908 -- Edit this bug report at http://bugs.php.net/?id=21908&edit=1

« previous php.bugs (#39417) next »