gpt4 book ai didi

c# - Fineuploader with Azure,空图像问题

转载 作者:行者123 更新时间:2023-12-02 23:17:39 27 4
gpt4 key购买 nike

我长期使用fineuploader的直接azure上传模块。我在上传图像时遇到困难。问题是,有时上传的图像是空的。当我从存储资源管理器查看它时,文件存在,但大小为 0 kb。当我从浏览器查看图像时,它显示为空白。

插件代码

var uploader = new qq.azure.FineUploader({
debug: true,
element: document.getElementById('fine-uploader'),
request: {
endpoint: 'https://xxxxx.blob.core.windows.net/assetscontainer'
},
signature: {
endpoint: '/File/GetSasKey',
cors: {
expected: true,
sendCredentials: false
}
},
uploadSuccess: {
endpoint: '/File/Success'
},
deleteFile: {
enabled: true
},
callbacks: {
onSubmit: function (id, name) {
var extension = name.substr((name.lastIndexOf('.') + 1));
var uuid = this.getUuid(id);
this.setUuid(id, "JobOrder_" + uuid);
this.setUploadSuccessParams({ entityID: 0, entityType: "orderID" }, id)

},
onComplete: function (id, fileName, responseJSON) {

console.log(responseJSON);
}
}
});

sas生成过程代码

[Route("sas")]
[HttpGet]
[AuthorizationType("*")]
public async Task<string> GetSasKey(string blobUri)
{
var credentials = new StorageCredentials("xxxxxxxxxxxx", "afxxxxxasfasf==");
var blob = new CloudBlockBlob(new Uri(blobUri), credentials);
var storageAccount = new CloudStorageAccount(credentials, true);


var sasParameters = new SharedAccessBlobPolicy()
{
SharedAccessExpiryTime = DateTime.UtcNow.AddHours(1),
Permissions = SharedAccessBlobPermissions.Write | SharedAccessBlobPermissions.Delete
};
var sasToken = blob.GetSharedAccessSignature(sasParameters);
var returnValue = blob.Uri.AbsoluteUri + sasToken;
return returnValue;
}

以及成功方法

public JsonResult Success (string blob, string uuid, string name, string container, int entityID, string entityType)
{
//do some work
}

最佳答案

这可能是 Fine Uploader 的问题。

Fine Uploader 是一个开源项目,一年多前被关闭。

https://github.com/FineUploader/fine-uploader/issues/2073

如果在代码中发现安全错误,对不活动的开源项目的依赖可能会出现问题。

我的建议是更换 Fine Uploader。

关于c# - Fineuploader with Azure,空图像问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58483623/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com