问题描述
我用Valums qq.FileUploader(前AjaxUpload)插件在我的Asp.net MVC 3应用程序上传...
I use Valums qq.FileUploader(ex-AjaxUpload) plugin for uploading in my Asp.net mvc 3 application...
我在我的网页某些按钮附加newimage
,并通过点击它,我得到的模态窗口,我通过加载局部视图将数据加载到该窗口。
I have some button in my page add-newimage
, and by clicking in it I get modal window, and I load data into that window by loading Partial View.
而在这部分观点我有按钮上传图像
,其中我想我的initilaize qq.FileUploader,但它并没有在任何地方工作...
And in that partial view I have button upload-image
, in which I want to initilaize my qq.FileUploader, but it doesn't work anywhere...
下面是code
$("#add-newimage").click(function () {
$("#add-image").load('/Design/AddImage/', function () {
$("#add-image").dialog('open');
var uploader= new qq.FileUploader({
element: document.getElementById("upload-image"),
action: '/Design/UploadImage',
allowedExtensions: ['jpg'],
onComplete: function (id, fileName, responseJSON) {
$("#hidden-path input").html("/Img/Temp/@User.Identity.Name/" + file);
alert($("#hidden-path input").html());
}
});
});
});
我怎样才能使它工作?
How can I make it work?
推荐答案
我会尽量把上传code在对话框的开放式的事件。
I would try to put the uploader code in the open event of your dialog.
$("#add-image").dialog({
open : function(event, ui) {
var uploader= new qq.FileUploader({
element: document.getElementById("upload-image"),
action: '/Design/UploadImage',
allowedExtensions: ['jpg'],
onComplete: function (id, fileName, responseJSON) {
$("#hidden-path input").html("/Img/Temp/@User.Identity.Name/" + file);
alert($("#hidden-path input").html());
}
}
});
..
$("#add-newimage").click(function () {
$("#add-image").load('/Design/AddImage/', function () {
$("#add-image").dialog('open');
});
});
这篇关于Valums qq.FileUploader不会当它的初始化工作,通过AJAX加载按钮后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!