如何实现 JsonResult 方法来传递 http://valums.com/ajax-upload/ 额外参数?
该网站 http://valums.com/ajax-upload/ 说:
Sending additional params
To add a parameter that will be passed as a query string with each upload use params option.
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader'),
action: '/server-side.upload',
// additional data to send, name-value pairs
params: {
param1: 'value1',
param2: 'value2'
}
});
我的问题是:我应该如何
public JsonResult UploadFile(string qqfile, ????)
{
}
正确实现传递“value1”和“value2”?
谢谢你!!!
The website http://valums.com/ajax-upload/ says that:
Sending additional params
To add a parameter that will be passed as a query string with each upload use params option.
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader'),
action: '/server-side.upload',
// additional data to send, name-value pairs
params: {
param1: 'value1',
param2: 'value2'
}
});
My question is: How do I should implement
public JsonResult UploadFile(string qqfile, ????)
{
}
correctly to pass 'value1' and 'value2'?
Thank you!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用模型绑定器来实现这一点。创建一个带有属性的类,其中属性的名称等于您发送的参数:
在操作中,使用 Postmodel。默认的模型绑定器将自动填充该类。
当然你也可以将qq文件放入模型中。
You can use the model binder for that. Create a class with properties, where the names of the properties are equal to the params you send:
In the action, use the Postmodel. The default model-binder will automatically populate the class.
ofcourse you could also put the qqfile in the Model.