azure: Set blob content type using PHP -
how use setblobproperties in php set contenttype? code below found via google, 1 isn't working. video appear in blob storage, content-type set to: application/octet-stream. language isn't set 'nl-be' shows 'empty'.
$storageclient->putlargeblob($_post['container'], $_post['filename'], $tempfile); $storageclient->setblobproperties($_post['container'], $_post['filename'], null, array( 'x-ms-blob-content-language' => 'nl-be', 'x-ms-blob-content-type' => 'video/mp4' ));
using new sdk, 1 can set content type follows(i have set content type gif image in example).
$blobrestproxy = servicesbuilder::getinstance()->createblobservice($connectionstring); //upload $blob_name = "image.gif"; $content = fopen("image.gif", "r"); $options = new createbloboptions(); $options->setblobcontenttype("image/gif"); try { //upload blob $blobrestproxy->createblockblob("containername", $blob_name, $content, $options); echo "success"; } catch(serviceexception $e){ $code = $e->getcode(); $error_message = $e->getmessage(); echo $code.": ".$error_message."<br />"; }
Comments
Post a Comment