我想获取弹出窗口被上传文件的文件名,用网站中的会员(就是直接在登录页面输入用户名和密码)可以在主窗口中获取到文件名。可是用数字证书(像U盘似的,数字证书也是一个用户,打开登录页面,自动登录)却获取不到文件名字了。是怎么回事?要是大家有空的话,帮我看看,我可以把代码贴出来。
主窗口代码:
JS代码:
<script type="text/javascript" language="javascript">
function openSetWindow(CtrlID) {
var xx = window.showModalDialog('/DesktopModules/BJTD_Project/UploadFile.aspx', 'subpage', 'dialogWidth:400px;dialogHeight:300px;center:yes;help:no;resizable:no;status:no');
document.getElementById(CtrlID).value = xx;
return false;
}
</script>
表单代码:
<asp:TextBox ID='txtPostContent' runat='server' CssClass='normal' /><asp:Button ID="btnPostContent"
runat="server" Text="上传文件" OnClientClick="return openSetWindow('txtPostContent');" />
弹出窗口代码:
表单代码:<form id="form1" runat="server">
<p>
请选择要上传的文件</p>
<p>
<asp:FileUpload ID="fulFile" runat="server" />
</p>
<p>
<asp:Button ID="btnSubmit" runat="server" Text="上传" onclick="btnSubmit_Click" />
</p>
</form>
CS文件代码: protected void btnSubmit_Click(object sender, EventArgs e)
{
string UploadName = this.fulFile.FileName;
string UploadType = UploadName.Substring(UploadName.LastIndexOf(".") + 1);
string newName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + "." + UploadType;
string SavePath = "/attachment/";
fulFile.SaveAs(MapPath(SavePath) + newName);
Response.Write("<script type=\"text/javascript\">window.returnValue=\"" + newName + "\";window.close();</script>");
}
麻烦大家看看,是什么原因啊。谢谢!!!