java - Retrieve an Image from a POST request -
After
I am trying to send a picture to my Java servlet (hosted on Amazon EC2) later Amazon S3 and How to move on to the surprise How to retrieve the image from a post request
Upload Code
The request (pic.imageData is an NSData type) has been sent through the iOS RestKit API :.
Rackpromes * Parameters = [Rak paramam]; [Parameter set value: pic.dateTaken forParam: @ "dateTak"]; [Parameter set value: uploaded for pic.datePRM: @ "dateduploaded"]; [Parameter setdata: pic.imageData MIMEType: @ "Image / JPG" for: @ "image"]; [RK Client Shared Client] Username = deviceID; [RK Client Shared Client] .password = session; [RK Client Shared Client] Authentication type = RKRext attestation type HTTPBics; UploadPictureRequest = [[RK Client Shared Client] Posted: kUploadPictureServlet params: Parameters Rep: Self]; parsing code stub
How can I parse 2 other parameters on the Java servlet:
double dateTaken = double. ParseDouble (req.getParameter ("dateTaken")); Double dateduploaded = double. PRADABB (rake jap parameter ("debtuploaded"); question
The question is:? I out how to parse image on your server lines of the but while some use:
// or @SuppressWarnings ( "unchecked") @SuppressWarnings ( "rawtypes") public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {If (ServletFileUpload.isMultipartContent (Request)) {Final FileItemFactory factory = New DiskFileItemFactory (); Last servlet file upload upload = new servile file upload (factory); {Try the final list items, upload Similarities (request); For (Iterator IRR = item prohibition), IRHH Next ();) {Final file item item = (FILESTEMY) IRAR Xx (); If (! Item.isFormField ()) {/ * * TODO: (for you) * 1. Verify that the file item is an image type. * 2. And do whatever you want with it. *}}} Catch (file uploadException E) {e.printStackTrace (); }}} Look at the API reference doctor to determine what to do next.
Comments
Post a Comment