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

From: Date: Mon, 03 Feb 2003 19:32:41 +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-32008@lists.php.net to get a copy of this message
ID: 21908 Comment by: evatckovacs@netscape.net Reported By: fn@panix.com Status: Feedback Bug Type: *General Issues Operating System: NetBSD-1.5.2 PHP Version: 4.3.0 New Comment: 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> Previous Comments: ------------------------------------------------------------------------ [2003-02-03 07:29:34] sniper@php.net Please try this script: <form method="post" action="upload.php" enctype="multipart/form-data"> <input type="file" name="portrait"> <input type="submit"> </form> <?php error_reporting(E_ALL); var_dump($_FILES); ?> If $_FILES array is empty after submit and no errors are given, try this script: <?php phpinfo(); ?> And check the file upload related settings from the output: post_max_size file_uploads upload_tmp_dir upload_max_filesize Also check your Apache error_log for any errors. ------------------------------------------------------------------------ [2003-01-31 09:21:27] arkadi@it.lv I also expirienced this problem. In my case I had "file_uploads = Off" in php.ini and then "php_flag file_uploads on" for every virtual host that require upload. That works perfectly in 4.2.3. According to phpinfo() setting private flag have no effect for this option in 4.3.0. I was forced to enable file uploads on system level in php.ini to solve the problem. ------------------------------------------------------------------------ [2003-01-29 09:34:37] fn@panix.com We are running both the apache module and the cgi. The problem is present in both. However, it was not present in 4.2.3 (both the apache module and the standalone version). ------------------------------------------------------------------------ [2003-01-29 00:02:07] sniper@php.net And is PHP compiled as module in Apache or are you running it as CGI? ------------------------------------------------------------------------ [2003-01-28 12:47:52] fn@panix.com There is no error message from that script. It fails silently. We are using Apache-1.3.27. Thanks for your help. ------------------------------------------------------------------------ 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 (#32008) next »