public function move(FilesystemFolder $destination) {

		if($this->alreadyUploaded) {
			return parent::move($destination);
		}

		$oldpath	= $this->folder->getPath() . $this->filename;
		$filename	= self::sanitizeFilename($this->originalName, $destination);
		$newpath	= $destination->getPath() . $filename;

		// ensure that only uploaded files are handled

		if(is_uploaded_file($oldpath)) {

			// move uploaded file

			if(@move_uploaded_file($oldpath, $newpath)) {

				// flag completed upload
				
				$this->alreadyUploaded = TRUE;
				
				// set new folder reference

				$this->folder = $destination;

				// set new filename

				$this->filename	= $filename;

				// re-read fileinfo

				$this->fileInfo	= new \SplFileInfo($newpath);

				// set cached instance

				self::$instances[$newpath] = $this;

				// @todo: check necessity of chmod
			
				@chmod($newpath, 0666 & ~umask());
				
			}

			else {
				throw new FilesystemFileException(sprintf("Could not move uploaded file '%s' to '%s'.", $this->originalName, $newpath), FilesystemFileException::FILE_RENAME_FAILED);
			}

		}
		
		else {
			throw new FilesystemFileException(sprintf("File '%s' was not identified as uploaded file.", $oldpath));
		}
		
		return $this;
				
	}
public function move(FilesystemFolder $destination) {

		if($this->alreadyUploaded) {
			return parent::move($destination);
		}

		$oldpath	= $this->folder->getPath() . $this->filename;
		$filename	= self::sanitizeFilename($this->originalName, $destination);
		$newpath	= $destination->getPath() . $filename;

		// ensure that only uploaded files are handled

		if(is_uploaded_file($oldpath)) {

			// move uploaded file

			if(@move_uploaded_file($oldpath, $newpath)) {

				// flag completed upload
				
				$this->alreadyUploaded = TRUE;
				
				// set new folder reference

				$this->folder = $destination;

				// set new filename

				$this->filename	= $filename;

				// re-read fileinfo

				$this->fileInfo	= new \SplFileInfo($newpath);

				// set cached instance

				self::$instances[$newpath] = $this;

				// @todo: check necessity of chmod
			
				@chmod($newpath, 0666 & ~umask());
				
			}

			else {
				throw new FilesystemFileException(sprintf("Could not move uploaded file '%s' to '%s'.", $this->originalName, $newpath), FilesystemFileException::FILE_RENAME_FAILED);
			}

		}
		
		else {
			throw new FilesystemFileException(sprintf("File '%s' was not identified as uploaded file.", $oldpath));
		}
		
		return $this;
				
	}
public function move ( FilesystemFolder $ destination ) { if ( $ this -> alreadyUploaded ) { return parent :: move ( $ destination ) ; } $ oldpath = $ this -> folder -> getPath ( ) . $ this -> filename ; $ filename = self :: sanitizeFilename ( $ this -> originalName , $ destination ) ; $ newpath = $ destination -> getPath ( ) . $ filename ; // ensure that only uploaded files are handled if ( is_uploaded_file ( $ oldpath ) ) { // move uploaded file if ( @ move_uploaded_file ( $ oldpath , $ newpath ) ) { // flag completed upload $ this -> alreadyUploaded = TRUE ; // set new folder reference $ this -> folder = $ destination ; // set new filename $ this -> filename = $ filename ; // re-read fileinfo $ this -> fileInfo = new \ SplFileInfo ( $ newpath ) ; // set cached instance self :: $ instances [ $ newpath ] = $ this ; // @todo: check necessity of chmod @ chmod ( $ newpath , 0666 & ~ umask ( ) ) ; } else { throw new FilesystemFileException ( sprintf ( "Could not move uploaded file '%s' to '%s'." , $ this -> originalName , $ newpath ) , FilesystemFileException :: FILE_RENAME_FAILED ) ; } } else { throw new FilesystemFileException ( sprintf ( "File '%s' was not identified as uploaded file." , $ oldpath ) ) ; } return $ this ; }
performs an initial move of an uploaded file
from its temporary folder to a destination folder
and renames it to the original filename
once completed a flag is set and subsequent
moves are redirected to the parent method

(non-PHPdoc)
@see \vxPHP\File\FilesystemFile::move()
performs an initial move of an uploaded file from its temporary folder to a destination folder and renames it to the original filename once completed a flag is set and subsequent moves are redirected to the parent method