diff --git a/app/code/Magento/Theme/Model/Design/Backend/File.php b/app/code/Magento/Theme/Model/Design/Backend/File.php
index 3baaf4fdf18d984b91de60fc5ed93987272e298f..dd9d3fdd13213da4523e08fa80c70523751b32cf 100644
--- a/app/code/Magento/Theme/Model/Design/Backend/File.php
+++ b/app/code/Magento/Theme/Model/Design/Backend/File.php
@@ -170,12 +170,14 @@ class File extends BackendFile
     protected function getStoreMediaUrl($fileName)
     {
         $fieldConfig = $this->getFieldConfig();
+        $baseUrl = '';
+        $urlType = ['_type' => UrlInterface::URL_TYPE_MEDIA];
         if (isset($fieldConfig['base_url'])) {
             $baseUrl = $fieldConfig['base_url'];
-            $urlType = empty($baseUrl['type']) ? 'link' : (string)$baseUrl['type'];
-            $fileName = $this->urlBuilder->getBaseUrl(['_type' => $urlType]) . $baseUrl['value'] . '/' . $fileName;
+            $urlType = ['_type' => empty($baseUrl['type']) ? 'link' : (string)$baseUrl['type']];
+            $baseUrl = $baseUrl['value'] . '/';
         }
-        return $fileName;
+        return $this->urlBuilder->getBaseUrl($urlType) . $baseUrl  . $fileName;
     }
 
     /**
diff --git a/app/code/Magento/Theme/Test/Unit/Model/Design/Backend/FileTest.php b/app/code/Magento/Theme/Test/Unit/Model/Design/Backend/FileTest.php
index c11b539f2b807953673046aa075a46398272c810..ba28b69339c9378e7a82912b705fa8a888f8a9d5 100644
--- a/app/code/Magento/Theme/Test/Unit/Model/Design/Backend/FileTest.php
+++ b/app/code/Magento/Theme/Test/Unit/Model/Design/Backend/FileTest.php
@@ -5,6 +5,7 @@
  */
 namespace Magento\Theme\Test\Unit\Model\Design\Backend;
 
+use Magento\Framework\UrlInterface;
 use Magento\Theme\Model\Design\Backend\File;
 use Magento\Framework\App\Filesystem\DirectoryList;
 
@@ -13,8 +14,8 @@ class FileTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Framework\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject */
     protected $mediaDirectory;
 
-    /** @var \Magento\Theme\Model\Design\Config\FileUploader\Config|\PHPUnit_Framework_MockObject_MockObject */
-    protected $fileConfig;
+    /** @var UrlInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $urlBuilder;
 
     /** @var File */
     protected $fileBackend;
@@ -29,17 +30,18 @@ class FileTest extends \PHPUnit_Framework_TestCase
         $requestData = $this->getMockObjectForAbstractClass(
             'Magento\Config\Model\Config\Backend\File\RequestData\RequestDataInterface'
         );
-        $filesystem = $this->getMockObject('Magento\Framework\Filesystem');
-        $this->fileConfig = $this->getMockObject('Magento\Theme\Model\Design\Config\FileUploader\Config');
-
-        $this->mediaDirectory = $this->getMockObjectForAbstractClass(
-            'Magento\Framework\Filesystem\Directory\WriteInterface'
-        );
+        $filesystem = $this->getMockBuilder('Magento\Framework\Filesystem')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->mediaDirectory = $this->getMockBuilder('Magento\Framework\Filesystem\Directory\WriteInterface')
+            ->getMockForAbstractClass();
 
         $filesystem->expects($this->once())
             ->method('getDirectoryWrite')
             ->with(DirectoryList::MEDIA)
             ->willReturn($this->mediaDirectory);
+        $this->urlBuilder = $this->getMockBuilder('Magento\Framework\UrlInterface')
+            ->getMockForAbstractClass();
 
         $this->fileBackend = new File(
             $context,
@@ -49,7 +51,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
             $uploaderFactory,
             $requestData,
             $filesystem,
-            $this->fileConfig
+            $this->urlBuilder
         );
     }
 
@@ -85,7 +87,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
 
     public function testAfterLoad()
     {
-        $value = '/filename.jpg';
+        $value = 'filename.jpg';
         $this->fileBackend->setValue($value);
         $this->fileBackend->setFieldConfig(
             [
@@ -93,20 +95,36 @@ class FileTest extends \PHPUnit_Framework_TestCase
                     'value' => 'value',
                     'config' => 'system/filesystem/media',
                 ],
+                'base_url' => [
+                    'type' => 'media',
+                    'value' => 'design/file'
+                ],
             ]
         );
+
+        $this->mediaDirectory->expects($this->once())
+            ->method('isExist')
+            ->with('value/' . $value)
+            ->willReturn(true);
+        $this->urlBuilder->expects($this->once())
+            ->method('getBaseUrl')
+            ->with(['_type' => UrlInterface::URL_TYPE_MEDIA])
+            ->willReturn('http://magento2.com/pub/media/');
+        $this->mediaDirectory->expects($this->once())
+            ->method('getRelativePath')
+            ->with('value')
+            ->willReturn('value');
         $this->mediaDirectory->expects($this->once())
             ->method('stat')
-            ->with($value)
+            ->with('value/' . $value)
             ->willReturn(['size' => 234234]);
-        $this->fileConfig->expects($this->once())
-            ->method('getStoreMediaUrl')
-            ->willReturn('http://magento2.com/pub/media');
+
+
         $this->fileBackend->afterLoad();
         $this->assertEquals(
             [
                 [
-                    'url' => 'http://magento2.com/pub/media' . $value,
+                    'url' => 'http://magento2.com/pub/media/design/file/' . $value,
                     'file' => $value,
                     'size' => 234234,
                     'exists' => true,
@@ -119,7 +137,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
     public function testBeforeSave()
     {
         $value = 'filename.jpg';
-        $tmpMediaPath = 'tmp/image/' . $value;
+        $tmpMediaPath = 'tmp/design/file/' . $value;
         $this->fileBackend->setScope('store');
         $this->fileBackend->setScopeId(1);
         $this->fileBackend->setValue(
@@ -139,10 +157,10 @@ class FileTest extends \PHPUnit_Framework_TestCase
                 ],
             ]
         );
-        $this->fileConfig->expects($this->exactly(2))
-            ->method('getTmpMediaPath')
-            ->with($value)
-            ->willReturn($tmpMediaPath);
+//        $this->fileConfig->expects($this->exactly(2))
+//            ->method('getTmpMediaPath')
+//            ->with($value)
+//            ->willReturn($tmpMediaPath);
 
         $this->mediaDirectory->expects($this->once())
             ->method('copyFile')
diff --git a/app/code/Magento/Theme/Test/Unit/Model/Design/Config/FileUploader/FileProcessorTest.php b/app/code/Magento/Theme/Test/Unit/Model/Design/Config/FileUploader/FileProcessorTest.php
index efb8334e67a17a6fbf43379962d1b5d9c9b3c9d1..ceda9e18effa1d80bc1beaaa523b0347f5268544 100644
--- a/app/code/Magento/Theme/Test/Unit/Model/Design/Config/FileUploader/FileProcessorTest.php
+++ b/app/code/Magento/Theme/Test/Unit/Model/Design/Config/FileUploader/FileProcessorTest.php
@@ -5,6 +5,8 @@
  */
 namespace Magento\Theme\Test\Unit\Model\Design\Config\FileUploader;
 
+use Magento\Framework\App\Filesystem\DirectoryList;
+use Magento\Framework\UrlInterface;
 use Magento\Theme\Model\Design\Config\FileUploader\FileProcessor;
 
 class FileProcessorTest extends \PHPUnit_Framework_TestCase
@@ -15,9 +17,6 @@ class FileProcessorTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\MediaStorage\Model\File\Uploader|\PHPUnit_Framework_MockObject_MockObject */
     protected $uploader;
 
-    /** @var \Magento\Theme\Model\Design\Config\FileUploader\Config|\PHPUnit_Framework_MockObject_MockObject */
-    protected $imageConfig;
-
     /** @var \Magento\Theme\Model\Design\BackendModelFactory|\PHPUnit_Framework_MockObject_MockObject */
     protected $backendModelFactory;
 
@@ -27,6 +26,15 @@ class FileProcessorTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Theme\Model\Design\Config\MetadataProvider|\PHPUnit_Framework_MockObject_MockObject */
     protected $metadataProvider;
 
+    /** @var \Magento\Framework\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $directoryWrite;
+
+    /** @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $storeManager;
+
+    /** @var \Magento\Store\Api\Data\StoreInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $store;
+
     /** @var FileProcessor */
     protected $fileProcessor;
 
@@ -39,9 +47,6 @@ class FileProcessorTest extends \PHPUnit_Framework_TestCase
         $this->uploader = $this->getMockBuilder('Magento\MediaStorage\Model\File\Uploader')
             ->disableOriginalConstructor()
             ->getMock();
-        $this->imageConfig = $this->getMockBuilder('Magento\Theme\Model\Design\Config\FileUploader\Config')
-            ->disableOriginalConstructor()
-            ->getMock();
         $this->backendModelFactory = $this->getMockBuilder('Magento\Theme\Model\Design\BackendModelFactory')
             ->disableOriginalConstructor()
             ->getMock();
@@ -51,11 +56,27 @@ class FileProcessorTest extends \PHPUnit_Framework_TestCase
         $this->metadataProvider = $this->getMockBuilder('Magento\Theme\Model\Design\Config\MetadataProvider')
             ->disableOriginalConstructor()
             ->getMock();
+        $filesystem = $this->getMockBuilder('Magento\Framework\Filesystem')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->directoryWrite = $this->getMockBuilder('Magento\Framework\Filesystem\Directory\WriteInterface')
+            ->getMockForAbstractClass();
+        $filesystem->expects($this->once())
+            ->method('getDirectoryWrite')
+            ->with(DirectoryList::MEDIA)
+            ->willReturn($this->directoryWrite);
+        $this->storeManager = $this->getMockBuilder('Magento\Store\Model\StoreManagerInterface')
+            ->getMockForAbstractClass();
+        $this->store = $this->getMockBuilder('Magento\Store\Api\Data\StoreInterface')
+            ->setMethods(['getBaseUrl'])
+            ->getMockForAbstractClass();
+
         $this->fileProcessor = new FileProcessor(
             $this->uploaderFactory,
-            $this->imageConfig,
             $this->backendModelFactory,
-            $this->metadataProvider
+            $this->metadataProvider,
+            $filesystem,
+            $this->storeManager
         );
     }
 
@@ -69,6 +90,17 @@ class FileProcessorTest extends \PHPUnit_Framework_TestCase
                 'backend_model' => 'Magento\Theme\Model\Design\Backend\File'
             ],
         ];
+        $this->storeManager->expects($this->once())
+            ->method('getStore')
+            ->willReturn($this->store);
+        $this->store->expects($this->once())
+            ->method('getBaseUrl')
+            ->with(UrlInterface::URL_TYPE_MEDIA)
+            ->willReturn('http://magento2.com/pub/media/');
+        $this->directoryWrite->expects($this->once())
+            ->method('getAbsolutePath')
+            ->with('tmp/' . FileProcessor::FILE_DIR)
+            ->willReturn('absolute/path/to/tmp/media');
 
         $this->metadataProvider->expects($this->once())
             ->method('get')
@@ -97,23 +129,15 @@ class FileProcessorTest extends \PHPUnit_Framework_TestCase
         $this->uploader->expects($this->once())
             ->method('addValidateCallback')
             ->with('size', $this->backendModel, 'validateMaxSize');
-        $this->imageConfig
-            ->expects($this->once())
-            ->method('getAbsoluteTmpMediaPath')
-            ->willReturn('absolute/path/to/tmp/media');
         $this->uploader->expects($this->once())
             ->method('save')
             ->with('absolute/path/to/tmp/media')
             ->willReturn(['file' => 'file.jpg', 'size' => '234234']);
-        $this->imageConfig->expects($this->once())
-            ->method('getTmpMediaUrl')
-            ->with('file.jpg')
-            ->willReturn('http://magento2.com/pub/media/tmp/file.jpg');
         $this->assertEquals(
             [
                 'file' => 'file.jpg',
                 'size' => '234234',
-                'url' => 'http://magento2.com/pub/media/tmp/file.jpg'
+                'url' => 'http://magento2.com/pub/media/tmp/' . FileProcessor::FILE_DIR . '/file.jpg'
             ],
             $this->fileProcessor->saveToTmp($fieldCode)
         );