|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-01-27 12:38 UTC] fn at panix dot com
I am running the following code in php-4.3.0:
<?
$portrait = $_FILES["portrait"];
print "<hr>_FILES[portrait]: <pre>\n";
print_r($portrait);
print "</pre>";
$portrait = $_GLOBALS["portrait"];
print "<hr>_FILES[portrait]: <pre>\n";
print_r($portrait);
print $_FILES["portrait"]["error"];
print "</pre>";
?>
<form method="post"
action="t.cgi"
ENCTYPE="multipart/form-data">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type=file name=portrait>
<input type="submit">
</form>
The file does not appear to be uploaded. However, with php-4.2.3,
everything works fine. I have confirmed that both file_uploads and
register_globals are on. This problem occurs in both the apache module
and the standalone version.
is_uploaded_file() also reports failure with php-4.3.0.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 12:00:01 2025 UTC |
Hello. I am also finding this error. I am actually running on Linux but everything else is the same version. this is kind of stolen out of the wrox book. the variable $afile is empty but $crud gets passed over just fine. am i referring to it incorrectly? this is making me nuts and i have an enduser crawling on me to get his scripts fixed. please help. thank you [kovacs@darth eva]$ more cispt1test.php <? function upload_form() { global $phpself; $phpself = $_SERVER["PHP_SELF"]; print "<form name='formtest' method='post' enctype='multipart/form-data' action='$phpself'>"; print "<input type='hidden' name='action' value='upload'>"; print "<input type='file' name='afile'>"; print "<input type='text' name='crud'>"; print "<input type='submit' name='submit' value='upload'>"; print "<input type='reset' name='reset' value='reset'>"; print "</form>"; } function upload_file() { global $afile; error_reporting(E_ALL); $afile = $_POST["afile"]; $crud = $_POST["crud"]; print "some stuff"; print "$afile $crud"; if (!@copy($afile,"/tmp/crud")) die ("Can't upload"); var_dump($_FILES); } ?> <html> <head><title>test</title> <meta http-equiv = "Content-type" content="text/html; charset=iso-8859-1"> </head> <body> <? $action = $_POST["action"]; print "action = $action"; if ($action == 'upload') upload_file(); else upload_form(); ?> </body></html>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"); } ?>J dont have $_FILE ("array(0) { }") in Openwall Linux but J have $FILE in Mandrake 9.0 . On both systems J have the some apache,php,test files, configuracion files please help ... ?