精细上传器从 MVC 端点获取参数
Fine uploader get params from MVC endpoint
我尝试按照以下方式设置精细的上传器参数
callbacks: {
onUpload: function (id, name) {
var params = {fileSize: uploader.getSize(id), fileName: name };
uploader.setUploadSuccessParams(params, id); // Work
uploader.setParams({ newPar: "321" }); // Doesn't work
},
}
我可以从成功端点获取成功参数,如下所示
[HttpPost]
[Route("success")] //Succes endpoint
public async Task OnUploadSuccess()
{
var fileName = Request.Form.Get("fileName");
var fileSize = long.Parse(Request.Form.Get("fileSize"));
}
但是不能对参数做同样的事情
[HttpGet]
[Route("sas")] //Request endpoint
public ContentResult CreateSas()
{
var param= Request.Form.Get("newPar"); //Doesn't work
}
关于如何在 MVC 控制器中获取此参数的任何帮助
setParams
将参数作为 headers 发送到 Azure,附加到 "PUT BLOB" 请求。您不能将自定义参数发送到 SAS 端点。 https://github.com/FineUploader/fine-uploader/issues/1224
我尝试按照以下方式设置精细的上传器参数
callbacks: {
onUpload: function (id, name) {
var params = {fileSize: uploader.getSize(id), fileName: name };
uploader.setUploadSuccessParams(params, id); // Work
uploader.setParams({ newPar: "321" }); // Doesn't work
},
}
我可以从成功端点获取成功参数,如下所示
[HttpPost]
[Route("success")] //Succes endpoint
public async Task OnUploadSuccess()
{
var fileName = Request.Form.Get("fileName");
var fileSize = long.Parse(Request.Form.Get("fileSize"));
}
但是不能对参数做同样的事情
[HttpGet]
[Route("sas")] //Request endpoint
public ContentResult CreateSas()
{
var param= Request.Form.Get("newPar"); //Doesn't work
}
关于如何在 MVC 控制器中获取此参数的任何帮助
setParams
将参数作为 headers 发送到 Azure,附加到 "PUT BLOB" 请求。您不能将自定义参数发送到 SAS 端点。 https://github.com/FineUploader/fine-uploader/issues/1224