UploadBase: Set mFileSize, if given, even if mTempPath is unknown
[lhc/web/wiklou.git] / includes / upload / UploadBase.php
index fb25249..9d7b294 100644 (file)
@@ -241,12 +241,14 @@ abstract class UploadBase {
         */
        protected function setTempFile( $tempPath, $fileSize = null ) {
                $this->mTempPath = $tempPath;
+               $this->mFileSize = $fileSize ?: null;
                if ( strlen( $this->mTempPath ) && file_exists( $this->mTempPath ) ) {
                        $this->tempFileObj = new TempFSFile( $this->mTempPath );
-                       $this->mFileSize = $fileSize ?: filesize( $this->mTempPath );
+                       if ( !$fileSize ) {
+                               $this->mFileSize = filesize( $this->mTempPath );
+                       }
                } else {
                        $this->tempFileObj = null;
-                       $this->mFileSize = null;
                }
        }