Index: trunk/phase3/includes/upload/UploadFromFile.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | function initializeFromRequest( &$request ) { |
15 | 15 | $desiredDestName = $request->getText( 'wpDestFile' ); |
16 | 16 | if( !$desiredDestName ) |
17 | | - $desiredDestName = $request->getText( 'wpUploadFile' ); |
| 17 | + $desiredDestName = $request->getFileName( 'wpUploadFile' ); |
18 | 18 | return $this->initializePathInfo( |
19 | 19 | $desiredDestName, |
20 | 20 | $request->getFileTempName( 'wpUploadFile' ), |
Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -67,8 +67,8 @@ |
68 | 68 | |
69 | 69 | // Guess the desired name from the filename if not provided |
70 | 70 | $this->mDesiredDestName = $request->getText( 'wpDestFile' ); |
71 | | - if( !$this->mDesiredDestName ) { |
72 | | - $this->mDesiredDestName = $request->getText( 'wpUploadFile' ); |
| 71 | + if( !$this->mDesiredDestName && $request->getFileName( 'wpUploadFile' ) !== null ) { |
| 72 | + $this->mDesiredDestName = $request->getFileName( 'wpUploadFile' ); |
73 | 73 | } |
74 | 74 | $this->mComment = $request->getText( 'wpUploadDescription' ); |
75 | 75 | $this->mLicense = $request->getText( 'wpLicense' ); |
— | — | @@ -226,6 +226,7 @@ |
227 | 227 | |
228 | 228 | 'texttop' => $this->uploadFormTextTop, |
229 | 229 | 'textaftersummary' => $this->uploadFormTextAfterSummary, |
| 230 | + 'destfile' => $this->mDesiredDestName, |
230 | 231 | ) ); |
231 | 232 | $form->setTitle( $this->getTitle() ); |
232 | 233 | |
— | — | @@ -718,6 +719,7 @@ |
719 | 720 | protected $mSessionKey; |
720 | 721 | protected $mHideIgnoreWarning; |
721 | 722 | protected $mDestWarningAck; |
| 723 | + protected $mDestFile; |
722 | 724 | |
723 | 725 | protected $mTextTop; |
724 | 726 | protected $mTextAfterSummary; |
— | — | @@ -731,6 +733,7 @@ |
732 | 734 | ? $options['sessionkey'] : ''; |
733 | 735 | $this->mHideIgnoreWarning = !empty( $options['hideignorewarning'] ); |
734 | 736 | $this->mDestWarningAck = !empty( $options['destwarningack'] ); |
| 737 | + $this->mDestFile = isset( $options['destfile'] ) ? $options['destfile'] : ''; |
735 | 738 | |
736 | 739 | $this->mTextTop = isset( $options['texttop'] ) |
737 | 740 | ? $options['texttop'] : ''; |
— | — | @@ -903,6 +906,9 @@ |
904 | 907 | 'id' => 'wpDestFile', |
905 | 908 | 'label-message' => 'destfilename', |
906 | 909 | 'size' => 60, |
| 910 | + 'default' => $this->mDestFile, |
| 911 | + # FIXME: hack to work around poor handling of the 'default' option in HTMLForm |
| 912 | + 'nodata' => strval( $this->mDestFile ) !== '', |
907 | 913 | ), |
908 | 914 | 'UploadDescription' => array( |
909 | 915 | 'type' => 'textarea', |