Pārlūkot izejas kodu

[HttpFoundation] TemporaryStorage automatically creates the directory if it doesn't exist yet

Bernhard Schussek 14 gadi atpakaļ
vecāks
revīzija
19073ae655

+ 1 - 1
src/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php

@@ -25,6 +25,6 @@ class FileNotFoundException extends FileException
      */
     public function __construct($path)
     {
-        parent::__construct(sprintf('The file %s does not exist', $path));
+        parent::__construct(sprintf('The file "%s" does not exist', $path));
     }
 }

+ 4 - 0
src/Symfony/Component/HttpFoundation/File/TemporaryStorage.php

@@ -24,6 +24,10 @@ class TemporaryStorage
 
     public function __construct($secret, $directory)
     {
+        if (!file_exists($directory)) {
+            mkdir($directory, 0777, true);
+        }
+
         $this->directory = realpath($directory);
         $this->secret = $secret;
     }