cvs: pear /HTTP_Upload Upload.php

From: Date: Sat, 10 Nov 2001 13:08:03 +0000
Subject: cvs: pear /HTTP_Upload Upload.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1286@lists.php.net to get a copy of this message
cox Sat Nov 10 08:08:03 2001 EDT Modified files: /pear/HTTP_Upload Upload.php Log: Has been repotered that the class works also under Windows (Thanks Alan T. Miller <amiller@hollywood101.com>) Index: pear/HTTP_Upload/Upload.php diff -u pear/HTTP_Upload/Upload.php:1.9 pear/HTTP_Upload/Upload.php:1.10 --- pear/HTTP_Upload/Upload.php:1.9 Fri Oct 26 22:18:12 2001 +++ pear/HTTP_Upload/Upload.php Sat Nov 10 08:08:03 2001 @@ -7,7 +7,7 @@ // // ********************************************** // -// $Id: Upload.php,v 1.9 2001/10/27 02:18:12 cox Exp $ +// $Id: Upload.php,v 1.10 2001/11/10 13:08:03 cox Exp $ /* * Pear File Uploader class. Easy and secure managment of files @@ -431,11 +431,8 @@ */ function moveTo ($dir_dest, $overwrite=true) { - if (OS_WINDOWS) { - return $this->raiseError('not tested yet'); - } if (!$this->isValid()) { - return $this->raiseError ($this->upload['error']); + return $this->raiseError($this->upload['error']); } $err_code = $this->_chk_dir_dest($dir_dest); if ($err_code !== false) { @@ -445,11 +442,8 @@ if (!$this->mode_name_selected) { $this->setName('safe'); } - $slash = ''; - if ($dir_dest[strlen($dir_dest)-1] != '/') { - $slash = '/'; - } - $name_dest = $dir_dest . $slash . $this->upload['name']; + + $name_dest = $dir_dest . DIRECTORY_SEPARATOR . $this->upload['name']; if (@is_file($name_dest)) { if ($overwrite !== true) { @@ -459,10 +453,10 @@ } } // Copy the file and let php clean the tmp - if (!@copy ($this->upload['tmp_name'], $name_dest)) { + if (!@copy($this->upload['tmp_name'], $name_dest)) { return $this->raiseError('E_FAIL_MOVE'); } - @chmod ($name_dest, 0660); + @chmod($name_dest, 0660); return $this->getProp('name'); }

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