Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira Plugin with File Uploading

Carl Nolan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 14, 2012

I'm trying to create a plugin which needs to read some data from a user-supplied file. I've tried a normal file-input HTML element in a form in a velocity template and posting to an action Java class (I think that makes sense?) but it seems that no files are passed.

I'm using the Apache ServletFileUpload class along with some others which are supposed to work for exactly what I need. I seem to be doing everything as per the tutorials I've seen around but it's not working. It does however work when I remove the enc-type but just for non-file inputs such as text, passwords etc.

So I've come to the conclusion that Jira is causing these issues. Anyone done something like this before or know if it's possible? Thanks The "receiving" code:

DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();

    ServletFileUpload upload = new ServletFileUpload(fileItemFactory);
    FileItemIterator iterator = upload.getItemIterator(request);

    List items = upload.parseRequest(request);
    Iterator it = items.iterator();

    while (it.hasNext()) {
    	FileItem item = (FileItem) it.next();
    	System.out.println("Got file");
    }

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Carl Nolan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 19, 2012
TAGS
AUG Leaders

Atlassian Community Events