// Guess the desired name from the filename if not provided
$this->mDesiredDestName = $request->getText( 'wpDestFile' );
- if( !$this->mDesiredDestName ) {
- $this->mDesiredDestName = $request->getText( 'wpUploadFile' );
+ if( !$this->mDesiredDestName && $request->getFileName( 'wpUploadFile' ) !== null ) {
+ $this->mDesiredDestName = $request->getFileName( 'wpUploadFile' );
}
$this->mComment = $request->getText( 'wpUploadDescription' );
$this->mLicense = $request->getText( 'wpLicense' );
'texttop' => $this->uploadFormTextTop,
'textaftersummary' => $this->uploadFormTextAfterSummary,
+ 'destfile' => $this->mDesiredDestName,
) );
$form->setTitle( $this->getTitle() );
protected $mSessionKey;
protected $mHideIgnoreWarning;
protected $mDestWarningAck;
+ protected $mDestFile;
protected $mTextTop;
protected $mTextAfterSummary;
? $options['sessionkey'] : '';
$this->mHideIgnoreWarning = !empty( $options['hideignorewarning'] );
$this->mDestWarningAck = !empty( $options['destwarningack'] );
+ $this->mDestFile = isset( $options['destfile'] ) ? $options['destfile'] : '';
$this->mTextTop = isset( $options['texttop'] )
? $options['texttop'] : '';
'id' => 'wpDestFile',
'label-message' => 'destfilename',
'size' => 60,
+ 'default' => $this->mDestFile,
+ # FIXME: hack to work around poor handling of the 'default' option in HTMLForm
+ 'nodata' => strval( $this->mDestFile ) !== '',
),
'UploadDescription' => array(
'type' => 'textarea',
function initializeFromRequest( &$request ) {
$desiredDestName = $request->getText( 'wpDestFile' );
if( !$desiredDestName )
- $desiredDestName = $request->getText( 'wpUploadFile' );
+ $desiredDestName = $request->getFileName( 'wpUploadFile' );
return $this->initializePathInfo(
$desiredDestName,
$request->getFileTempName( 'wpUploadFile' ),