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

  • SEARCH
  • Home
  • 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 8215109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:40:40+00:00 2026-06-07T11:40:40+00:00

I am trying to send a picture to my java servlet (hosted on amazon

  • 0

I am trying to send a picture to my java servlet (hosted on amazon ec2) to later transfer it to amazon s3 and wonder how to retrieve the Image from the post request.

Upload Code

The request is sent through iOS RestKit API like this (pic.imageData is a NSData type):

RKParams* params = [RKParams params];

[params setValue:pic.dateTaken forParam:@"dateTaken"];
[params setValue:pic.dateUploaded forParam:@"dateUploaded"];

[params setData:pic.imageData MIMEType:@"image/jpeg" forParam:@"image"];

[RKClient sharedClient].username = deviceID;
[RKClient sharedClient].password = sessionKey;

[RKClient sharedClient].authenticationType = RKRequestAuthenticationTypeHTTPBasic;

uploadPictureRequest = [[RKClient sharedClient] post:kUploadPictureServlet params:params delegate:self];

Parsing Code Stub

This is how I parse the other 2 parameters on the Java servlet:

double dateTaken = Double.parseDouble(req.getParameter("dateTaken"));
double dateUploaded = Double.parseDouble(req.getParameter("dateUploaded"));

Question

The question is: how do I retrieve and parse the image on my server?

  • 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-07T11:40:42+00:00Added an answer on June 7, 2026 at 11:40 am

    Something along the lines of this, using Apache Commons FileUpload:

     // or @SuppressWarnings("unchecked")
     @SuppressWarnings("rawtypes")
     public void doPost(HttpServletRequest request, HttpServletResponse response) 
             throws ServletException, IOException {
         if (ServletFileUpload.isMultipartContent(request)) {
             final FileItemFactory   factory = new DiskFileItemFactory();
             final ServletFileUpload upload  = new ServletFileUpload(factory);
    
             try {
                 final List items = upload.parseRequest(request);
    
                 for (Iterator itr = items.iterator(); itr.hasNext();) {
                     final FileItem item = (FileItem) itr.next();
    
                     if (!item.isFormField()) {
                        /*
                         * TODO: (for you)
                         *  1. Verify that file item is an image type.
                         *  2. And do whatever you want with it.
                         */
                     }
                 }
             } catch (FileUploadException e) {
                 e.printStackTrace();
             }
         }
     }
    

    Refer to the FileItem API reference doc to determine what to do next.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to send a picture from 'C:\picture.bmp' to 'c:\temp\picture.bmp' using server and
Hi so I'm trying to send an image (png) from the sdcard in an
im trying to send a picture from a android device to a server and
I'm trying to send information from a form and a hidden email variable (from
I am trying to send email using Exchange 2007 from a console app using
I am trying to send an email from a Ruby program. The smtp server
I'm trying to get a System.Drawing.Image (generated in a .NET dll) into a picture
i am trying to programmatically attach an image to an email body from my
I have an Android application where I'm trying to send a picture to a
I am trying to attach an image that is picked from the image gallery

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.