6fbeb519ca811a6f7f7314b445c8a1116db12587
6 * Implements uploading from previously stored file.
8 * @author Bryan Tong Minh
11 class UploadFromStash
extends UploadBase
{
12 public static function isValidSessionKey( $key, $sessionData ) {
13 return !empty( $key ) &&
14 is_array( $sessionData ) &&
15 isset( $sessionData[$key] ) &&
16 isset( $sessionData[$key]['version'] ) &&
17 $sessionData[$key]['version'] == self
::SESSION_VERSION
;
20 public static function isValidRequest( $request ) {
21 $sessionData = $request->getSessionData( 'wsUploadData' );
22 return self
::isValidSessionKey(
23 $request->getInt( 'wpSessionKey' ),
28 * some $na vars for uploadBase method compatibility.
30 public function initialize( $name, $sessionData, $na, $na2=false ) {
32 * Confirming a temporarily stashed upload.
33 * We don't want path names to be forged, so we keep
34 * them in the session on the server and just give
35 * an opaque key to the user agent.
38 parent
::initialize( $name,
39 $this->getRealPath ( $sessionData['mTempPath'] ),
40 $sessionData['mFileSize'],
44 $this->mFileProps
= $sessionData['mFileProps'];
47 public function initializeFromRequest( &$request ) {
48 $sessionKey = $request->getInt( 'wpSessionKey' );
49 $sessionData = $request->getSessionData('wsUploadData');
51 $desiredDestName = $request->getText( 'wpDestFile' );
52 if( !$desiredDestName )
53 $desiredDestName = $request->getText( 'wpUploadFile' );
54 return $this->initialize( $desiredDestName, $sessionData[$sessionKey], false );
58 * File has been previously verified so no need to do so again.
60 protected function verifyFile() {
65 * We're here from "ignore warnings anyway" so return just OK
67 public function checkWarnings() {