cvs: pear /HTTP_Upload Upload.php

From: Date: Wed, 28 Nov 2001 17:46:52 +0000
Subject: cvs: pear /HTTP_Upload Upload.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1425@lists.php.net to get a copy of this message
cox Wed Nov 28 12:46:52 2001 EDT Modified files: /pear/HTTP_Upload Upload.php Log: Store the final extension name if 'uniq' or 'safe' mode is selected as the 'ext' property instead of the initial value. The german translation of the NOT_ALLOWED_EXTENSION error code is still missing O:-) Index: pear/HTTP_Upload/Upload.php diff -u pear/HTTP_Upload/Upload.php:1.13 pear/HTTP_Upload/Upload.php:1.14 --- pear/HTTP_Upload/Upload.php:1.13 Wed Nov 28 12:11:00 2001 +++ pear/HTTP_Upload/Upload.php Wed Nov 28 12:46:52 2001 @@ -7,7 +7,7 @@ // // ********************************************** // -// $Id: Upload.php,v 1.13 2001/11/28 17:11:00 cox Exp $ +// $Id: Upload.php,v 1.14 2001/11/28 17:46:52 cox Exp $ /* * Pear File Uploader class. Easy and secure managment of files @@ -103,8 +103,8 @@ 'de' => 'Die zu erzeugende Datei existiert bereits und konnte nicht überschrieben werden' ), 'NOT_ALLOWED_EXTENSION' => array( - 'es' => 'Extension de fichero no valida', - 'en' => 'Not valid file extension' + 'es' => 'Extension de fichero no permitida', + 'en' => 'Not permitted file extension' ) ); } @@ -337,9 +337,16 @@ switch ($mode) { case 'uniq': $name = $this->nameToUniq(); + $this->upload['ext'] = $this->nameToSafe($this->upload['ext'], 10); + $name .= '.' . $this->upload['ext']; break; case 'safe': $name = $this->nameToSafe($this->upload['real']); + if (($pos = strrpos($name, '.')) !== false) { + $this->upload['ext'] = substr($name, $pos + 1); + } else { + $this->upload['ext'] = ''; + } break; case 'real': $name = $this->upload['real']; @@ -362,9 +369,8 @@ srand((double) microtime() * 1000000); $this->_seeded = 1; } - $uniq = uniqid(rand()); - return $uniq . '.' . $this->nameToSafe($this->upload['ext'],10); + return $uniq; } /**

« previous php.pear.cvs (#1425) next »