我目前正在尝试使用 DownloadToStream 方法从 Azure blob 存储下载文件,以将 blob 的内容下载为文本字符串。但是我没有得到任何东西,而是一个空字符串。
这是我用来连接到 azure blob 容器并检索 blob 文件的代码。
public static string DownLoadFroalaImageAsString(string blobStorageName, string companyID)
{
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference(companyID.ToLower());
//retrieving the actual filename of the blob
string removeString = "BLOB/";
string trimmedString = blobStorageName.Remove(blobStorageName.IndexOf(removeString), removeString.Length);
// Retrieve reference to a blob named "trimmedString"
CloudBlockBlob …Run Code Online (Sandbox Code Playgroud) 我最近将 Sweet Alert 1 移至 Sweet Alert 2,但根据文档,没有选项可以对像 Sweet Alert 1 这样的警报框的覆盖背景进行主题化
.swal-overlay {
background-color: rgba(43, 165, 137, 0.45);
}.
Run Code Online (Sandbox Code Playgroud)
请问如何实现更改Sweet Alert 2的叠加背景?
我目前正在与sweetalert2合作,并且尝试检测警报何时关闭。但是,不会触发DeleteUnsavedImages函数。我认为将功能分配给onclose键会起作用,但是没有运气。
swal({
html: data,
showCloseButton: false,
showCancelButton: false,
width: 800,
showConfirmButton: false,
onClose: DeleteUnsavedImages()
}).then(function () {
});
function DeleteUnsavedImages(){
var test = "-1";
}
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激 :-)
我试图使用azures blob存储实现以下功能.
奇怪的是,我只能使用一个工作,因为它会导致另一个工作,这取决于我的代码的顺序.
HttpPostedFile image = Request.Files["froalaImage"];
if (image != null)
{
string fileName = RandomString() + System.IO.Path.GetExtension(image.FileName);
string companyID = Request.Form["companyID"].ToLower();
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference(companyID);
// Create the container if it doesn't already exist.
container.CreateIfNotExists();
// Retrieve reference to a blob named "filename".
CloudBlockBlob blockBlob = container.GetBlockBlobReference(fileName); …Run Code Online (Sandbox Code Playgroud) 我试图从内存流中的azure的blob存储中下载pdf文件.但是,当我尝试打开文件时,它不会加载.
这是我正在使用的代码. 下载代码
protected void blobDownload_Click(object sender, EventArgs e)
{
//Getting the blob storage container values
DBAccess dbaCon = new DBAccess();
DataTable dt = dbaCon.GetTrainingRecord(TrainingTrainingRecordID.Value);
string companyID = dt.Rows[0].Field<string>("fk_company_id");
string blobStorageName = dt.Rows[0].Field<string>("uploaded_file");
string filename = dt.Rows[0].Field<string>("display_file_name");
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference(System.Text.RegularExpressions.Regex.Replace(companyID.ToLower(), @"\s+", ""));
CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobStorageName);
MemoryStream memStream = new MemoryStream();
blockBlob.DownloadToStream(memStream);
blockBlob.FetchAttributes();
HttpResponse response = HttpContext.Current.Response;
//response.ContentType = blockBlob.Properties.ContentType;
response.ContentType = "application/pdf";
response.AddHeader("Content-Disposition", "Attachment; filename=" + filename);
response.AddHeader("Content-Length", blockBlob.Properties.Length.ToString());
response.BinaryWrite(memStream.ToArray()); …Run Code Online (Sandbox Code Playgroud) 我正在使用甜蜜警报,但如果 ajax 的请求完成,我想让它自动关闭
swal({
title: "Are you sure?",
text: "You are choosing order by custom search",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Confirm",
closeOnConfirm: false,
timer: **AUTO WITH AJAX??**
},
Run Code Online (Sandbox Code Playgroud)
我正在添加一个变量
var dones = $(document).ajaxComplete(function(){
swal.close()
});
Run Code Online (Sandbox Code Playgroud)
并像这样制作 swal
swal({
title: "Are you sure?",
text: "You are choosing order by custom search",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Confirm",
**timer: dones,**
closeOnConfirm: false
},
Run Code Online (Sandbox Code Playgroud)
但仍然不像我预期的那样
azure ×3
c# ×3
sweetalert2 ×3
.net ×2
javascript ×2
sweetalert ×2
ajax ×1
firefox ×1
jquery ×1
pdf ×1
php ×1