getSessionData( 'wsUploadData' ); return self::isValidSessionKey( $request->getInt( 'wpSessionKey' ), $sessionData ); } /* * some $na vars for uploadBase method compatibility. */ public function initialize( $name, $sessionData, $na=false, $na2=false ) { /** * Confirming a temporarily stashed upload. * We don't want path names to be forged, so we keep * them in the session on the server and just give * an opaque key to the user agent. */ parent::initialize( $name, $this->getRealPath ( $sessionData['mTempPath'] ), $sessionData['mFileSize'], false ); $this->mVirtualTempPath = $sessionData['mTempPath']; $this->mFileProps = $sessionData['mFileProps']; } public function initializeFromRequest( &$request ) { $this->mSessionKey = $request->getInt( 'wpSessionKey' ); $sessionData = $request->getSessionData('wsUploadData'); $desiredDestName = $request->getText( 'wpDestFile' ); if( !$desiredDestName ) $desiredDestName = $request->getText( 'wpUploadFile' ); return $this->initialize( $desiredDestName, $sessionData[$this->mSessionKey], false ); } /** * File has been previously verified so no need to do so again. */ protected function verifyFile() { return true; } /** * There is no need to stash the image twice */ public function stashSession() { if ( !empty( $this->mSessionKey ) ) return $this->mSessionKey; return parent::stashSession(); } /** * Remove a temporarily kept file stashed by saveTempUploadedFile(). * @return success */ public function unsaveUploadedFile() { $repo = RepoGroup::singleton()->getLocalRepo(); $success = $repo->freeTemp( $this->mVirtualTempPath ); return $success; } }