Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7715891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:30:03+00:00 2026-06-01T02:30:03+00:00

I have a multipart form which is supposed to upload a file as well

  • 0

I have a multipart form which is supposed to upload a file as well as some parameters. It looks like this:

<form id="upload" action="http://localhost:9998/test" method="post" enctype="multipart/form-data">
    <input name="inputfile" type="file" size="50" accept="application/octet-stream">
    <input name="someparameter" type="text" size="10">
    <input type="submit" value="Go!">
</form>

The web service looks like this:

@Path("/test")
public class ServiceInterface {
    @POST
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public void execute(@FormParam(value="someparameter") String param) {
        System.out.println(param);
    }
}

When submitting the form, the value for “someparameter” is always reported as null although in the form I entered a value.

My questions are:

  1. What is wrong with the above code?
  2. How would I access the file which is transmitted with the form?

I am using Jersey 1.10.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:30:05+00:00Added an answer on June 1, 2026 at 2:30 am

    Ok, after googling quite a few hours I found the error in my code.

    You have to use the annotation @FormDataParam instead of @FormParam.

    The resulting code looks like this:

    @Path("/test")
    public class ServiceInterface {
        @POST
        @Consumes(MediaType.MULTIPART_FORM_DATA)
        public void execute(
                       @FormDataParam("someparameter") String param
                       @FormDataParam("inputfile") File inputfile
                           )
        {
            System.out.println(param);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form, like this <form id=picuploadform enctype=multipart/form-data method=post action=> <div class=row> <label
I found this ajax file upload script here http://www.phpletter.com/Demo/AjaxFileUpload-Demo/ Which is supposed to add
Let's say we have this code: <form action='' method='POST' enctype='multipart/form-data'> <input type='file' name='userFile'><br> <input
This is my markup: <form action=/Customer/Create enctype=multipart/form-data method=post> <input id=file type=file style=width:300px /> <input
I have a form which contains among others: <form id=new_basic_ad class=new_basic_ad method=post enctype=multipart/form-data action=/basic_ads
I've got a form which looks like that: <form method=post enctype=multipart/form-data onsubmit=return new_post_form_submit();> <input
If I have a html form like the following: <form name=statusForm action=post.php method=post enctype=multipart/form-data>
I have a form on which I use validation. This form has a section
I have come across a dynamically written form which I would like to style
I have a form in my app which is triggering the wrong controller action.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.