I.E中的文件上载控制问题

时间:2012-02-06 09:02:46

标签: .net

我遇到了fileupload的问题 当我用javascript打开它(在IE中)并从我的计算机中选择任何文件时,似乎工作正常但我无法在代码隐藏文件中访问该文件(此控件返回null,但它在FireFox中工作正常)。

我有一个图像按钮,我想打开文件上传

<img src="../images/newimages/btn_sok.gif" onclick="javascript:document.getElementById('ctl00_ContentPlaceHolder1_Uploadimages').click();" width="36" height="17" alt="" />

我的文件上传控件

<asp:FileUpload ID="Uploadimages" Width="218" Style="float: right; opacity: 0; filter: alpha(opacity = 0);" runat="server" onchange="javascript:copyvalue();" />

然后我有copyvalue()函数将该控件的值复制到另一个文本框

function copyvalue() {
    var filename = document.getElementById("ctl00_ContentPlaceHolder1_Uploadimages").value;   
    filename = filename.substring(filename.lastIndexOf("\\") + 1);
    document.getElementById("txtupload").value = filename;
}

abc.aspx.cs页面

中访问此控件时出现问题
if (Uploadimages.HasFile)

它什么都不返回。

0 个答案:

没有答案
相关问题