#46150 [Opn->Bgs]: File Upload does not work after upgarde from 4.X
| From: | tularis@php.net | Date: | Mon, 22 Sep 2008 14:17:38 +0000 |
| Subject: | #46150 [Opn->Bgs]: File Upload does not work after upgarde from 4.X | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-129185@lists.php.net to get a copy of this message | ||
ID: 46150
Updated by: tularis@php.net
Reported By: npandey2 at sapient dot com
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Windows Server 2003
PHP Version: 5.2.6
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. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
http://nl.php.net/manual/en/features.file-upload.errors.php
Previous Comments:
------------------------------------------------------------------------
[2008-09-22 11:46:14] npandey2 at sapient dot com
Description:
------------
We upgraded out Data Hosting platform from PHP Version 4.4.2 to 5.2.6
and after that the script to upload files keeps failing.
The relevent settings in PHP.ini file
open_basedir = NOT Set
safe_mode = On
file_uploads = On
upload_tmp_dir = C:\Windows\Temp
Cannot submit URL as the installation is curerntly at the integration
environment
Reproduce code:
---------------
PHP Script :
<html>
<head><title>DataUpload per PHP</title></head>
<body>
<?
$file_dir = "./files/";
$userfile = $_FILES['userfile']['name'];
$tmp = $_FILES['userfile']['tmp_name'];
$err = $_FILES['userfile']['error'];
$size = $_FILES['userfile']['size'];
echo "phpversion: " . phpversion() . "<br />";
echo "fileuploads: " . get_cfg_var('file_uploads') . "<br />";
echo "upload_tmp_dir: " . get_cfg_var('upload_tmp_dir') . "<br
/>";
echo "file_dir: " . $file_dir . "<br />";
echo "userfile: " . $userfile . "<br />";
echo "tmp :" . $tmp . "<br /><br />";
if ($_POST['submit'] == "Senden") {
if ($_FILES["file"]["error"] > 0){
echo "Return Code: " . $_FILES["file"]["error"] . "<br
/>";
} elseif (file_exists($file_dir.$userfile)) {
die ("File does not exists!");
} elseif (move_uploaded_file($tmp, $file_dir.$userfile)) {
die ("Data file $userfile copied");
}
else{
die ("Data Upload failed!");
}}
else {
?>
<form enctype="multipart/form-data" action="<?php echo
$_SERVER['PHP_SELF']; ?>" method="post">
<h3>Data File: <input name="userfile" type="file" /> </h3>
<input type="submit" name="submit" value="Senden" />
</form>
<?php
}
?>
</body>
</html>
Expected result:
----------------
PHP Script : phpversion: 5.2.4
fileuploads: 1
upload_tmp_dir: C:\Windows\Temp
file_dir: ./files/
userfile: 2.txt
tmp :C:\WINDOWS\Temp\php8487.tmp
Data file 2.txt copied
Actual result:
--------------
PHP Script : phpversion: 5.2.4
fileuploads: 1
upload_tmp_dir: C:\Windows\Temp
file_dir: ./files/
userfile: 2.txt
tmp :
Return Code: 6
Data Upload failed!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46150&edit=1