function uploadButtonClick()
{
    document.forms[0].attachFile.click()
}
function fileClick()
{
    document.forms[0].text1.value=document.forms[0].attachFile.value;
}<html:file property="attachFile" style="display:none" onchange="fileClick();"/>
<Input type="text" name="text1" class="form_field" value="">
<Input type="button" class="button"  value="<bean:message key='label.ir.uploadhardcopy.button.browse'/>" name="button1" onClick="uploadButtonClick()">
为什么这样会出现access is denied ,我已经降低了浏览器的安全权限,该怎么解决呢?

解决方案 »

  1.   

    应该是你要上传的文件被锁了,你没有使用他的权限,个人感觉和你的程序没有问题
    或者你能更详细的描述你的问题,并给出全面的代码,至少应该包括form部分
      

  2.   

    form 是这样的<html:form action="/saveAttachAction.do" method="post" enctype="multipart/form-data">
      

  3.   

    要解决此问题,必须关闭“简单文件共享”,然后获取文件夹的所有权:
    1. 关闭“简单文件共享”:
    a.  单击“开始”,然后单击“我的电脑”。
    b.  在“工具”菜单上,单击“文件夹选项”,然后单击“查看”选项卡。
    c.  在“高级设置”下,单击以清除“使用简单文件共享 (推荐)”复选框,然后单击“确定”。
    2. 右键单击您希望获得其所有权的文件夹,然后单击“属性”。
    3. 单击“安全”选项卡,然后单击“安全”消息框(如果出现)中的“确定”。
    4. 单击“高级”,然后单击“所有者”选项卡。
    5. 在“名称”列表中,单击您的用户名,如果您是作为管理员登录的,请单击“Administrator”,或者单击“Administrators”组。如果您希望获得该文件夹内容的所有权,请单击以选中“替换子容器及对象的所有者”复选框。
    6. 单击“确定”。您可能会收到以下错误信息,其中 Folder 是您想获得其所有权的文件夹的名称:
    You do not have permission to read the contents of directory Folder.Do you want to replace the directory permissions with permissions granting you Full Control?All permissions will be replaced if you press Yes.
    7. 单击“是”。
    8. 单击“确定”,然后对该文件夹及其内容重新应用您希望的权限及安全设置。
      

  4.   

    http://support.microsoft.com/kb/810881/zh-cn
      

  5.   

    <form action="" method=post enctype=multipart/data >
    <input type=file name=123 ID="”file”1">
      

  6.   

    主要是因为我不能单纯的用<file:input> ,我的按钮需要有CSS样式,所以需要用这种变通的方法,不过就是不知道为什么这样就会被denied了
      

  7.   

    结贴了 应该是浏览器的问题,只要你用其他控件操作了<html:file>就会报这个,不能提交了
    网上找了一个变通的方法,把<html:file>变透明,然后显示自己的BUTTON,下面贴一下,代码不多,<html>
    <script>
    function fclick(obj){
    with(obj){
    style.posTop=event.y-offsetHeight/2
    style.posLeft=event.x-offsetWidth/2
    }
    }
    </script>
    <style>
    input{}{border:1px solid #333333;color:#666666;background:#eeeeee;font:normal 12px Tahoma;height:18px}
    </style>
    <br>
    <br>
    <br>
    <table>
    <tr>
    <td>
    <form method="post" action="" enctype="multipart/form-data">
    <input id="f_file">&nbsp;<input type="button" onmouseover="fclick(t_file)" value="选择上传文件">
    <br>
    <input name="upload" type="file" style="position:absolute;filter:alpha(opacity=10);width:30px;" id="t_file" onchange="f_file.value=this.value" hidefocus>
    <br><input type="submit" value="提交">
    </form>
    </tr>
    </table>
    </html>