2012-02-06 54 views
0

我在处理程序和JavaScript中添加文件名作为响应我试图获取处理程序中添加的值并将其保存到一个隐藏的领域。但隐藏的字段值始终为空。我没有收到我添加到响应中的文件名。我如何获得的文件名从处理器如何将处理程序的值传递给aspx页面作为响应

public class Upload : IHttpHandler, System.Web.SessionState.IRequiresSessionState 
{  
    public void ProcessRequest (HttpContext context) 
    { 
     context.Response.Write(filename); 
     context.Response.StatusCode = 200; 
    } 
} 


    <script type="text/javascript"> 
     $(document).ready(function() { 
      $("#<%=AFU_Video.ClientID%>").uploadify({ 
       'uploader': 'scripts/uploadify.swf', 
       'script': 'Upload.ashx', 
       'buttonText': 'Video', 
       'cancelImg': 'images/cancel.png', 
       'folder': 'D:\Media', 
       'fileExt': '*.mp4', 
       'fileDesc': 'Video Files (.mp4 Only)', 
       'multi': true, 
       'auto': true, 
       'onComplete': function (event, ID, fileObj, response, data) { 
        document.getElementById("<%= Hidd_VideoLoc.ClientID %>").value = response.filename; 

回答

3

您正在尝试使用响应对象的filename财产响应,但你正在返回纯文本有没有这样的属性。

只需使用响应:

document.getElementById("<%= Hidd_VideoLoc.ClientID %>").value = response; 
相关问题