#21908 [Opn->Bgs]: File upload problems beginning in 4.3.0
| From: | iliaa@php.net | Date: | Tue, 04 Feb 2003 21:20:01 +0000 |
| Subject: | #21908 [Opn->Bgs]: File upload problems beginning in 4.3.0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-32115@lists.php.net to get a copy of this message | ||
ID: 21908
Updated by: iliaa@php.net
Reported By: fn@panix.com
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: NetBSD-1.5.2
PHP Version: 4.3.0
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2003-02-04 15:14:40] evatckovacs@netscape.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.mauch@gmx.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@netscape.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
------------------------------------------------------------------------
[2003-02-03 13:36:48] fn@panix.com
The problem for me was that upload_tmp_dir did not need to be set in
4.2.3. By default, it used /tmp. Now if it isn't set, nothing
happens. However, now that it is set in the php.ini everything is
working again.
------------------------------------------------------------------------
[2003-02-03 13:32:40] evatckovacs@netscape.net
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>
------------------------------------------------------------------------
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