This page contains obsolete content, which may refer to a previous version of JSPWiki. Please refactor this page or at least don't rely on this information.

File Upload Problems#

In my server(RedHat9,Tomcat5.0.18),when I use the default upload configuration,It didn't work,response 403 error from the server.
I found the problem is the config in web.xml:
   <servlet-mapping>
       <servlet-name>AttachmentServlet</servlet-name>
       <url-pattern>/wiki/attach</url-pattern>
   </servlet-mapping>

when I upload a file,the server attempt accessing the "/attach" directory insteand of send the request to the AttachmentServlet.So,I modified the config:
   <servlet-mapping>
       <servlet-name>AttachmentServlet</servlet-name>
       <url-pattern>/wiki/attach.do</url-pattern>
   </servlet-mapping>

and the uploadTemplate.jsp:
<form action="/wiki/attach.do" method="POST" enctype="multipart/form-data" accept-charset="UTF-8">
then,I can upload files.
But,A new problem is :
The files that uploaded can't access!

The bug is the file attachment url is HARDCODE in WikiEngine:
public String getAttachmentURL(String attName){
    return m_baseURL + "attach?page=" + encodeName(attName);
}
so,I add ".do" after attach,then it work now.

--LukeHan


Q: Did you have to recompile the WikiEngine code with:

return m_baseURL + "attach.do?page=" + encodeName(attName);
or
return m_baseURL + "/wiki/attach.do?page=" + encodeName(attName);

I just tried it with the hard coded "/wiki/attach?page" and it worked fine without the *.do extension.

--RickA

Add new attachment

In order to upload a new attachment to this page, please use the following box to find the file, then click on “Upload”.
« This page (revision-9) was last changed on 24-May-2008 19:40 by JanneJalkanen