cvs: pear /HTML_QuickForm QuickForm.php
| From: | Bertrand Mansion | Date: | Wed, 05 Dec 2001 10:15:05 +0000 |
| Subject: | cvs: pear /HTML_QuickForm QuickForm.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1468@lists.php.net to get a copy of this message | ||
mansion Wed Dec 5 05:15:05 2001 EDT
Modified files:
/pear/HTML_QuickForm QuickForm.php
Log:
Added possibility to define a custom file name when moving
uploaded file, instead of using the default one.
Index: pear/HTML_QuickForm/QuickForm.php
diff -u pear/HTML_QuickForm/QuickForm.php:1.7 pear/HTML_QuickForm/QuickForm.php:1.8
--- pear/HTML_QuickForm/QuickForm.php:1.7 Wed Dec 5 04:17:17 2001
+++ pear/HTML_QuickForm/QuickForm.php Wed Dec 5 05:15:05 2001
@@ -17,7 +17,7 @@
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
-// $Id: QuickForm.php,v 1.7 2001/12/05 09:17:17 mansion Exp $
+// $Id: QuickForm.php,v 1.8 2001/12/05 10:15:05 mansion Exp $
require_once("PEAR.php");
require_once("HTML/Common.php");
@@ -359,15 +359,17 @@
* Moves an uploaded file into the destination
* @param string $element
* @param string $dest
+ * @param string $fileName (optional)destination name for uploaded file
* @since 1.0
* @access public
*/
- function moveUploadedFile($element, $dest)
+ function moveUploadedFile($element, $dest, $fileName='')
{
$file = $this->_submitFiles[$element];
if ($dest != "" && substr($dest, -1) != "/")
$dest .= "/";
- if (copy($file["tmp_name"], $dest . $file["name"])) {
+ $fileName = ($fileName != '') ? $fileName : $file['name'];
+ if (copy($file["tmp_name"], $dest . $fileName)) {
@unlink($file["tmp_name"]);
return true;
} else {