我正在尝试实现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);
}
}
}
}
我缺少什么?