cvs: pear /HTML_QuickForm QuickForm.php
| From: | Bertrand Mansion | Date: | Sat, 01 Feb 2003 15:56:26 +0000 |
| Subject: | cvs: pear /HTML_QuickForm QuickForm.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8636@lists.php.net to get a copy of this message | ||
mansion Sat Feb 1 10:56:26 2003 EDT
Modified files:
/pear/HTML_QuickForm QuickForm.php
Log:
Use move_uploaded_file instead of copy and unlink as it is supported since PHP 4.1 and works
better in safe mode.
Thanks to Matthias Englert for noticing.
Index: pear/HTML_QuickForm/QuickForm.php
diff -u pear/HTML_QuickForm/QuickForm.php:1.50 pear/HTML_QuickForm/QuickForm.php:1.51
--- pear/HTML_QuickForm/QuickForm.php:1.50 Sat Jan 11 14:25:08 2003
+++ pear/HTML_QuickForm/QuickForm.php Sat Feb 1 10:56:26 2003
@@ -17,7 +17,7 @@
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
-// $Id: QuickForm.php,v 1.50 2003/01/11 19:25:08 mansion Exp $
+// $Id: QuickForm.php,v 1.51 2003/02/01 15:56:26 mansion Exp $
require_once('PEAR.php');
require_once('HTML/Common.php');
@@ -40,7 +40,7 @@
'textarea'
=>array('HTML/QuickForm/textarea.php','HTML_QuickForm_textarea'),
'link'
=>array('HTML/QuickForm/link.php','HTML_QuickForm_link'),
'advcheckbox'
=>array('HTML/QuickForm/advcheckbox.php','HTML_QuickForm_advcheckbox'),
- 'date'
=>array('HTML/QuickForm/date.php','HTML_QuickForm_date')
+ 'date'
=>array('HTML/QuickForm/date.php','HTML_QuickForm_date')
);
// {{{ error codes
@@ -304,9 +304,9 @@
$method = (strtoupper($method) == 'GET') ? 'GET' : 'POST';
$action = ($action == '') ? $_SERVER['PHP_SELF'] : $action;
$this->updateAttributes(array('action'=>$action,
'method'=>$method, 'name'=>$formName, 'target'=>$target));
- $this->_registeredTypes = &$GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'];
+ $this->_registeredTypes =& $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'];
$this->_submitValues = $GLOBALS['_' . $method];
- $this->_submitFiles = $_FILES;
+ $this->_submitFiles =& $_FILES;
} // end constructor
// }}}
@@ -472,12 +472,11 @@
*/
function moveUploadedFile($element, $dest, $fileName='')
{
- $file = $this->_submitFiles[$element];
+ $file =& $this->_submitFiles[$element];
if ($dest != '' && substr($dest, -1) != '/')
$dest .= '/';
$fileName = ($fileName != '') ? $fileName : $file['name'];
- if (copy($file['tmp_name'], $dest . $fileName)) {
- @unlink($file['tmp_name']);
+ if (move_uploaded_file($file['tmp_name'], $dest . $fileName) {
return true;
} else {
return false;