-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdown_b.html
37 lines (27 loc) · 1.24 KB
/
down_b.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?
require("lib/common.lib.html");
//require("include/header.html");
use MicrosoftAzure\Storage\Common\ServicesBuilder;
use MicrosoftAzure\Storage\Common\ServiceException;
use MicrosoftAzure\Storage\Blob\Models\ListBlobsOptions;
$s_name = filter_input(INPUT_GET, 's_name', FILTER_SANITIZE_SPECIAL_CHARS);
if(is_null($s_name)) {
}
$c_name = filter_input(INPUT_GET, 'c_name', FILTER_SANITIZE_SPECIAL_CHARS);
if(is_null($c_name)) {
}
$b_name = filter_input(INPUT_GET, 'b_name', FILTER_SANITIZE_SPECIAL_CHARS);
if(is_null($b_name)) {
}
$connectionString = "DefaultEndpointsProtocol=https;AccountName=".$s_name.";AccountKey=".$bson_a[$s_name]["keys"]."";
$blobClient = ServicesBuilder::getInstance()->createBlobService($connectionString);
$blob = $blobClient->getBlob($c_name, $b_name);
$blob_info = $blob->getProperties();
$f_name = explode("/", $b_name);
header("Pragma: public");
header("Content-disposition: attachment; filename=".$f_name[count($f_name)-1]);
header("Content-type: ".$blob_info->getcontentType());
header("Content-length: ".$blob_info->getcontentLength());
header("Content-Transfer-Encoding: binary");
fpassthru($blob->getContentStream());
?>