@@ -36,13 +36,48 @@ public function url($path)
3636 return $ this ->adapter ->publicUrl ($ path , new Config );
3737 }
3838
39- /** @phpstan-ignore-next-line */
39+ /**
40+ * Get a temporary URL for the file at the given path.
41+ *
42+ * @param string $path
43+ * @param \DateTimeInterface $expiration
44+ * @return string
45+ */
46+ /** @phpstan-ignore-next-line */
4047 public function temporaryUrl ($ path , $ expiration , array $ options = [])
4148 {
4249 return $ this ->adapter ->temporaryUrl (
4350 $ path ,
4451 $ expiration ,
45- new Config (['permissions ' => 'r ' ])
52+ new Config (array_merge ( ['permissions ' => 'r ' ], $ options ) )
4653 );
4754 }
55+
56+ /**
57+ * Get a temporary upload URL for the file at the given path.
58+ *
59+ * @param string $path
60+ * @param \DateTimeInterface $expiration
61+ * @return array{url: string, headers: array<string, string>}
62+ */
63+ /** @phpstan-ignore-next-line */
64+ public function temporaryUploadUrl ($ path , $ expiration , array $ options = [])
65+ {
66+ $ url = $ this ->adapter ->temporaryUrl (
67+ $ path ,
68+ $ expiration ,
69+ new Config (array_merge (['permissions ' => 'cw ' ], $ options ))
70+ );
71+ $ contentType = isset ($ options ['content-type ' ]) && is_string ($ options ['content-type ' ])
72+ ? $ options ['content-type ' ]
73+ : 'application/octet-stream ' ;
74+
75+ return [
76+ 'url ' => $ url ,
77+ 'headers ' => [
78+ 'x-ms-blob-type ' => 'BlockBlob ' ,
79+ 'Content-Type ' => $ contentType ,
80+ ],
81+ ];
82+ }
4883}
0 commit comments