Uplodify 未触发 onComplete 事件
我正在尝试实现 uploadify,但由于某种原因我无法获取 onComplete 事件。
到目前为止,我的代码看起来像这样,uploadify 可以将文件上传到我选择的文件夹。
Sys.Application.add_load(AddAdvertise);
function AddAdvertise() {
$('.flUploadImage').uploadify({
'uploader': '/Templates/Public/Images/BuyAndSell/uploadify.swf',
'script': 'http://localhost:81/Templates/Public/HttpHandler/Upload.ashx',
'cancelImg': '/Templates/Public/Images/BuyAndSell/cancel.png',
'auto': true,
'folder': "/" + $('#<%=hdnGUID.ClientID %>').attr('Value'),
'method': 'POST',
onProgress: function() {
alert("test1");
}
,
onComplete: function() {
alert("test");
}
});
}
和我的上传处理程序
public void ProcessRequest(HttpContext context)
{
HttpPostedFile oFile = context.Request.Files["Filedata"];
if (oFile != null)
{
string folder =HttpContext.Current.Server.MapPath( mainFolder + @context.Request["folder"]);
if (System.IO.Directory.Exists(folder))
{
oFile.SaveAs(folder + "/"+oFile.FileName);
}
else
{
DirectoryInfo dir = Directory.CreateDirectory(folder);
if(dir != null)
{
oFile.SaveAs(folder + "/" + oFile.FileName);
}
}
}
}
我缺少什么?
I'm trying to implement uploadify, but for some reason I'm failing at getting the event onComplete.
My code looks like this so far and the uploadify can upload the files to the folder that I've selected.
Sys.Application.add_load(AddAdvertise);
function AddAdvertise() {
$('.flUploadImage').uploadify({
'uploader': '/Templates/Public/Images/BuyAndSell/uploadify.swf',
'script': 'http://localhost:81/Templates/Public/HttpHandler/Upload.ashx',
'cancelImg': '/Templates/Public/Images/BuyAndSell/cancel.png',
'auto': true,
'folder': "/" + $('#<%=hdnGUID.ClientID %>').attr('Value'),
'method': 'POST',
onProgress: function() {
alert("test1");
}
,
onComplete: function() {
alert("test");
}
});
}
and my upload handler
public void ProcessRequest(HttpContext context)
{
HttpPostedFile oFile = context.Request.Files["Filedata"];
if (oFile != null)
{
string folder =HttpContext.Current.Server.MapPath( mainFolder + @context.Request["folder"]);
if (System.IO.Directory.Exists(folder))
{
oFile.SaveAs(folder + "/"+oFile.FileName);
}
else
{
DirectoryInfo dir = Directory.CreateDirectory(folder);
if(dir != null)
{
oFile.SaveAs(folder + "/" + oFile.FileName);
}
}
}
}
What I'm missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此问题之前已在此处解决。
另外,您可以在 我的博客。
This issue is resolved previously here.
Also, you can find a demo of uploadify implementation in my blog.
我遇到了这个问题,我通过从服务器函数返回一些值来解决它。
I had this problem, and I solved it by returning some value from the server function.