Struts2 File Upload doesn't work on Internet-Explorer

て烟熏妆下的殇ゞ 提交于 2019-12-11 16:53:20

问题


I am having issue with Struts 2 file upload for Word file(.docx, .doc) in Internet Explorer. It works fine in Chrome and Firefox, but I am not sure what I am missing for IE. I am using IE9. I appreciate your advice.

<action name="saveOrUpdateUser" method="saveOrUpdate"
            class="com.adaptivsol.action.UsersAction">
    <interceptor-ref name="defaultStack">
        <param name="fileUpload.maximumSize">104857600</param>
        <param name="allowedTypes">
                text/plain,                 
                application/word,
                application/msword,
                application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
                application/vnd.openxmlformats-officedocument.wordprocessingml.document
        </param>
        <param name="allowedExtensions">doc,docx,txt</param>
    </interceptor-ref>
    <result name="success">./pages/login/register.jsp</result>
    <result name="input">./pages/login/register.jsp</result>
    <result name="error">./pages/login/register.jsp</result>
</action>

回答1:


Your parameters are wrong, the fileUpload. prefix is missing in two of them, they need to be:

<param name="fileUpload.allowedTypes">
    text/plain,                 
    application/word,
    application/msword,
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
    application/vnd.openxmlformats-officedocument.wordprocessingml.document
</param>
<param name="fileUpload.allowedExtensions">doc,docx,txt</param>

By the way, set devMode to true in struts.xml, and post here the logs where the file upload stop working. We need to see an error, a warning, a message, something to understand what's wrong.

Also in your JSP add actionerrors, actionmessages and fielderrors printing capabilities, and report here the message you get.



来源:https://stackoverflow.com/questions/29851868/struts2-file-upload-doesnt-work-on-internet-explorer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!