[{TableOfContents }]


!!How do [WikiAttachments] work ?

Please do see the [wiki attachments] page for more information.

--[JanneJalkanen], 09-Dec-02.

!!Attachment uploading

Q: Why doesn't attachment uploading work on MSIE 5.22 on Mac OS X? For example, an attachment added to a page called JavaScript is uploaded to a folder called %0D%0AJavaScript-att/ , not JavaScript-att/ . However, attachment uploading does work in Mozilla Firebird 0.6.1! - [Xiaan]

A: Because MSIE 5.22 on Mac OS X is broken, I guess. :-P

__Comment__ - ''Uhm, speaking of StupidQuestions, why don't you use Safari?  [Pic/smile.png]  It is MUCH faster than IE.  Mozilla works fairly well, also, as does Camino.  OmniWeb is adopting the WebCore framework, so it should work fairly well, too.  I only use IE when those browsers fail.  Also, keep in mind that IE on the Macintosh (OS 9 or OS X) is essentially end-of-lifed now.  --MichaelGentry''

__Comment__ - ''Safari is nice, but I can't mandate it for the 500+ users we have running MSIE 5.22 on OS X. It looks to be something with document encoding? I'm using the default, not UTF-8, and saw the warnings in the jspwiki.properties file, so perhaps my modified question is how do I convert to UTF-8 for all my wikis?'' - [Xiaan]

__Comment__ - ''Ah ... yes, getting them to all upgrade might be an issue.  I'm not positive, but I believe you can just change the encoding to UTF-8 (I think UTF-8 is a superset of ISO-8859-1, but I really don't know that this is a fact).  What I'd do is make a copy of your wiki and change the encoding in the copy and see if it works.  Where are you that you have 500+ users running OS X?  Sounds like my kind of place!  --MichaelGentry''

__Comment__ - Should this question be in [Bug Reports]?  (Probably)

A: Seems like a bug.  Will fix.  Upgrading to UTF-8 works simply by setting the encoding to UTF-8, JSPWiki will automatically detect old pages still using ISO-8859-1.  However, note that there is NO going back, once you start to use UTF-8.  Most modern browsers understand UTF-8 so it should not really be a problem anyway. -- JanneJalkanen

__Comment__ - ''Problem was not solved by upgrading to UTF-8, looking forward to a patch.'' -Xiaan

''Please check if 2.0.50 helps in this regard.  I don't have access to a MacOSX machine.  --JanneJalkanen''

__Comment__ - ''I recently had an issue supporting MacOSX for work. (And yes, I am an MacOSX user at home as well!) In the process of researching the issue, I learned that Micorosft no longer supports IE on MacOSX at all; you cannot even download it from their site!  They instead instruct users to use Safari.  In my experience, Firefox is much more compatible and reliable.  I advise directing users to Firefox if possible.'' --Sage_Sam

Q: I have added an attachment with spaces in the filename to a wiki page.  The attachment can be accessed from the paperclip link with no problems, but if I create an inline link to the attachment the percent signs are stripped from the link and I get a page not found.  Is this a bug?  Is there a work around? --[JTBell]

Q: Problems with attachment uploading__\\

Whenever I try to upload a file on [my site|http://hydraphonic.info/groovewiki/Wiki.jsp?page=SandBox], I can browse a file etc but as soon as I hit upload, the upload dialog goes into "page cannot be found" error.

Can anyone give me some troubleshooting tips?


-- [RobertBrown] (v2.0.52)

A: check attachment directory and its permissions__\\
The process that your JSP container is running as must have permission to write into your attachment directory. (For example, if you have tomcat running as user ''tomcat4'' on your provider's server, user ''tomcat4'' or a group it belongs to must have write permission for the attachment directory.) If you run on a hosted server, you may need to ask your providers to help with this operation. --[ebu]

''Attachment dir has 775 permission.  That's even more than the data dir, and surely enough.'' - [RobertBrown]

__Q:__I set the attach diretory with 777 permission on my wiki site(by FTP tool).but when I upload a file,I got a 403 error from the server,and I create the dir manually,such as :News-att,and set the permission,but the same error return:( so How can I do? My server env:Linux(Red Hat9)+Tomcat5.1.18 --[LukeHan]

__Q1:__ How can a user __delete__ a file?

A1: There isn't a way to delete a file -- you need to request it be deleted and let an admin do it at some point.

__Q1a:__ How can an __admin__ delete a page?

A1a: Change into the dir where JSPWiki stores the attachements (this is the directory where jspwiki.basicAttachementProvider.storageDir from WEB_INF/jspwiki.properties points to) and remove the WIKINAME_att directory, where WIKINAME is the the name of the page to which the attachement was added. - [eMGe]

Restart your servlet engine after deleting a page or attachment. --[medale]
!!UTF-8 vs. ISO-8859-1

__Q__: Ehh, once again concerning UTF-8 vs. ISO-8859-1: Uploading an attachment to a page with a non-ascii char in its name (e.g. a German Umlaut like [รค|http://en.wikipedia.org/wiki/%C4] = ä) results in a NPE caused by the page not being found. It can be resolved by changing the accept-encoding of the multipart form from UTF-8 to ISO-8859-1, but looking at the history of ~UploadTemplate.jsp this seems to be long time a topic for some minor versions already. What should I do? Changing the configuration of the browser is out of discussion. jspwiki.encoding is set by default i.e. ISO, and as far as I understand, it's a bad idea to change it to UTF-8. Whether this would solve the problem....I don't know. (This whole encoding stuff seems to be somewhat messed up entirely - not being any fault of JSPWiki and its originators of course.) Can anybody give me some hints?

A: Urr.  Encoding *is* a problem, simply because most of the Internet originated in the USA, and everybody thought that ASCII is enough.  But most browsers *should* support UTF-8.  It's not a bad idea to change jspwiki encoding to UTF-8, since the change should be transparent.  Moving back to Latin1 *is*, however, difficult after the move.  Change the encoding to "<wiki:ContentEncoding />" and see if that helps.

__A__ : Found a solution regarding encoding problems with Tomcat. The reason to the problems is the Tomcat configuration\\Tomcat has his own http server, listening on 8080 port\\Using the admin application, you have to configure the 8080 connector, setting the URIEncoding parameter to UTF-8\\You have to do the same with the 8009 connector if you use an external http server\\ Thats all, I suppose it works with other containers\\
--[JPBergez], 02 may 2008

__Q__: Got the new 2.4.15 version and can't find any "Attach file ..." button. How can I attach files, now?

__A__: I had this problem too, gave up and turned my attention to authentication/authorization when I stumbled over the answer -- click 'Log In', 'Join Wiki' and create yourself a profile.  'Attach File' and 'Attachments' tab show up after creating a profile and ''logging in''.  Darren

!! Replacing Attachments

You can replace an attachment by re-attaching a file with the same name.

Note that older versions of the file are stored on the wiki server but are not accessible through the wiki.

!! Display Order of Attachments

__Q__: Does the list of attachments on a given page get displayed in any predefined order?

A: I'd always assumed that a page's attachments are listed alphabetically.

A: No, the order is random.

__Q__: I am just getting started with WIKI and having trouble getting my head around things! So, in HTML, I know I edit an html page and then place it in my html directory and it works, for WIKI, what file do I edit to set up a page, with the correct page tittles? What is WIKI's directory structure compared to plain html web publishing? Please help. JAMO

A: Errr... You just use the Wiki.  You don't have to put any files anywhere; just install and start editing.  Please see [Project Tattooine|OneMinuteWiki] for further information.

!! Changing attachment security restrictions

__Q__: I'm working on an internal wiki site for documentation purposes and one of the needs is to be able to
upload .doc files and similar. I have tried to find where the wiki implements the restriction on filetypes, but not been able to. Could anyone point me in the correct direction?

A: Please see [Security2.3FAQ].

!! Searching attachement files

Question : I'm wondering how could I modify the code source in order to make the search engine Wiki work on the attachments. Do you have any experience about it ?? Thanx


A: Subclass LuceneSearchProvider, and rewrite the getAttachmentContent() method.

Q: where is exactly the getAttachmentContent() method ? 
I guess the  Subclass LuceneSearchProvider is already set in the jspwiki.proprieties file.

A: "Subclass" is a verb in this case.  In Java terms, it's the same as "extend".  Look at the code, it should be pretty clear :)

Q: I modified the LuceneSearchProvider.java like you said , and i compiled it with JCreator to retrieve .class (it worked!!), after that , i re-created JSPWiki.jar and put it in  JSPWiki application, and re start it . I got these errors :



root cause

ANY ADVICE? thanks

Not really.  This could be one of a million reasons.  You'll need to debug your code very thoroughly...

-- JanneJalkanen

-Q- I just added the code found here http://www.jspwiki.org/wiki/SearchEnhancements In the LuceneSearchProvider.java file and compiled the package with java version 1.4.2:

    if(filename.endsWith(".txt") ||
           filename.endsWith(".xml") ||
           filename.endsWith(".ini") ||



        else if (filename.endsWith(".doc")) {

            InputStream attStream = null;


                attStream = mgr.getAttachmentStream( att );
                HWPFDocument doc = new HWPFDocument(attStream);

                Iterator it = doc.getTextTable().getTextPieces().iterator();

                StringBuffer sb = new StringBuffer(doc.characterLength());

                while(it.hasNext()) {

                    TextPiece tp = (TextPiece)it.next();



                String s = sb.toString();

                log.debug("Extracted text: " + s + " from attachment: " + filename);

                return s;


            catch (Exception e) 

                log.error("Attachment cannot be loaded", e);

                return null;


            finally {

                if (attStream != null) {

                    try {



                    catch (IOException e) {

                        log.warn("Couldn't close attachment stream for " + filename, e);


in the log file , found this :

2006-08-31 12:04:09 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception 


        at org.apache.jsp.Wiki_jsp._jspDestroy(Wiki_jsp.java:42)

        at org.apache.jasper.runtime.HttpJspBase.destroy(HttpJspBase.java:85)

        at org.apache.jasper.servlet.JspServletWrapper.destroy(JspServletWrapper.java:378)

 should I modify anything ?

Probably.  However, you just need to debug the code to see where it fails...

-- JanneJalkanen

Thanks Janne, but i already compiled and executed successfully the package with JCreator , it worked. but i still got these errors whe tried to integrate the jar in JSPWiki, I thinks tomcat did not load the classes files like it had to. so,...

do I have to modify others class than getAttachmentContent() in the LuceneSearchProvider.java ??

mac MSIE tends to encode attachments using mac-binary

utterly stupid, but can be decoded serverside...

--AnonymousCoward, 27-Feb-2006


Question: Is there any way to attach the file without registration such as function of attach file here?

Hey, guys, anybody knows how the refered function can be realized under JSP Wiki 2.4.53 background?

--icicleshan, 26-Sep-2006 

Yes, it's possible by changing your policy file (check out jspwiki.policy).  What is a refered function?

-- JanneJalkanen


As mentioned before, I am trying to realize to allow visitors to attach files without login into the website. You know, that's more convenient if a visitor just wants to attach files and illustrate something. How can he do this without being a member of this web?

--icicleshan, 15-Nov-2006


__Q:__ Why doesn't the Attach File tab show up on my wiki? I have set jspwiki.basicAttachmentProvider.storageDir and jspwiki.attachmentProvider (to BasicAttachmentProvider).  Is there more I need to do?  I don't see anything on the FAQAttachments or any other Attachment page.

Thanks in Advance

--sam, 10-Apr-2007

__A:__ If you are using the default security policy shipped with JSPWiki, then you will only see the 'Attach File' tab after logging into your Wiki.

If you want to change this so that Anonymous users can upload files, you have to edit your {{$JSPWiki_Home/WEB-INF/jspwiki.policy}} file. 

Within the section containing the following line:
principal com.ecyrd.jspwiki.auth.authorize.Role "Anonymous" {
Add the following line to that section:
permission com.ecyrd.jspwiki.auth.permissions.PagePermission "*:*", "upload"; 

For additional info, please see the [security documentation|http://doc.jspwiki.org/2.4/wiki/Security].

--David Au, 10-Apr-2007


Replacing Attachments

Is there a way to get rid of an older version of an attachment...other than renaming the attachment? I do not want to see the older versions?  Is there a way to change the order of the attachments? 

--AnonymousCoward, 20-Jul-2007


Hi. trying to add attachments but get a 500 error...

On jspwiki 2.4.102 using the default template that jspwiki ships with.

The Upload template has the following
{{{<form action="<wiki:Link format="url" jsp="attach"/>" method="post" enctype="multipart/form-data" accept-charset="<wiki:ContentEncoding/>">}}}

What have I done wrong?

--[Peter H.|mailto:phaig@tyro.com], 16-Aug-2007

Can I automatically open an paperclip attachment, like &#91;myAttach&#124;myattach.jsp&#93;, in a new tab/window?

OK, I answer myself: Yes, it works at least with a "normal URL link":  
Note: this will not produce the paperclip. Instead the result will be: [myText|http://mymachine/mywiki/attach/PageIncludingAttachment/myattach.jsp|target='_blank']
--[Jens J], 29-Apr-2009

In the latest stable version of JSPWiki (now 2.8.2) the attachments tab contains __incorrect__ links for the __Delete__ buttons. All buttons on the page try to delete the first attachment in the list.

Quick fix: comment out the button in the {{{<wiki:Permission permission="delete">}}} parts in the table. Use the delete button on the attachment page itself (click on the attachment version number) to delete the attachment.


I am upgrading from version 2.4.103 to 2.8.3. In the old version I was able to inline an attachment with this syntax:
* FROM Window-->Preferences
* JDK points to the right location (C:\Program Files\Java\jdk1.5.0_11)

With the new verion, the attachment is not inlined. Instead a hyperlink to the attachment is displayed. 

To duplicate what I had in the older version I now need to use the Image plugin:
* FROM Window-->Preferences
* JDK points to the right location (C:\Program Files\Java\jdk1.5.0_11)
[{Image src='m4e_01_jdk.jpg' align='center' }]

Moving to the newer version would require updating many pages. Is this really how attachments are inlined with version 2.8.3?