2012-02-06 30 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; 
相關問題