Uplodify not firing the onComplete event
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"]);
开发者_StackOverflow中文版 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?
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.
精彩评论