multipartform-data

Android Upload Multiple Files In A Single Request

自作多情 提交于 2020-01-11 12:53:27
问题 I'm posting content to the server in a multipart/form-data request. and the data I'm posting contains multiple parameters including a file array parameter (files[]). Using postman I'm setting the parameters and the files as: first-parameter=text content second-parameter=text content files[0]={first selected file} files[1]={second selected file} Submitting this request on postman is always successful, and the files are uploaded successfully. When I generate code snippets on postman, this is

Consuming a multipart/form-data via RESTful CXF

白昼怎懂夜的黑 提交于 2020-01-11 02:03:29
问题 I've been working in a webservice that consumes and produces JSON files using Apache CXF in conjuction with Jackson. However, one of the service's methods should be able to save an uploaded image from a mobile application that makes a multipart/form-data POST request to my webservice, and I don't know how to treat this kind of content-type within my context. We usually create "Request" and "Response" objects to consume and produce the JSON, however, I'm afraid this would not work for this

Python Requests Multipart HTTP POST

笑着哭i 提交于 2020-01-10 19:57:33
问题 I was wondering how do you translate something like this using Python Requests? In urllib2, you can manually manipulate the data that is being sent over the wire to the API service, but Requests claims multipart file uploads are easy. However, when trying to send over the same request using the Requests library, I believe that it is not specifying some key parameters in the content-type for each of the two parts correctly. Can someone please shed some light on this matter. Thank you in

@RequestPart with mixed multipart request, Spring MVC 3.2

与世无争的帅哥 提交于 2020-01-09 18:22:49
问题 I'm developing a RESTful service based on Spring 3.2. I'm facing a problem with a controller handling mixed multipart HTTP request, with a Second part with XMLor JSON formatted data and a second part with a Image file . I am using @RequestPart annotation for receiving the request @RequestMapping(value = "/User/Image", method = RequestMethod.POST, consumes = {"multipart/mixed"},produces="applcation/json") public ResponseEntity<List<Map<String, String>>> createUser( @RequestPart("file")

@RequestPart with mixed multipart request, Spring MVC 3.2

一曲冷凌霜 提交于 2020-01-09 18:22:49
问题 I'm developing a RESTful service based on Spring 3.2. I'm facing a problem with a controller handling mixed multipart HTTP request, with a Second part with XMLor JSON formatted data and a second part with a Image file . I am using @RequestPart annotation for receiving the request @RequestMapping(value = "/User/Image", method = RequestMethod.POST, consumes = {"multipart/mixed"},produces="applcation/json") public ResponseEntity<List<Map<String, String>>> createUser( @RequestPart("file")

How to process a multipart request consisting of a file and a JSON object in Spring restful service?

早过忘川 提交于 2020-01-09 09:03:50
问题 I have the following resource (implemented using Spring 4.05.RELEASE) which accepts a file and a JSON object: (P.S. activityTemplate is a serializable entity class) ... @RequestMapping(value="/create", method=RequestMethod.POST) public @ResponseBody ActivityTemplate createActivityTemplate( @RequestPart ActivityTemplate activityTemplate, @RequestPart MultipartFile jarFile) { //process the file and JSON } ... and this is the form I am testing from: <form method="POST" enctype="multipart/form

How to upload audio file to s3 via api gateway?

这一生的挚爱 提交于 2020-01-07 07:48:13
问题 I created an API in API Gateway to upload audio files to s3, the file is sending from local PC as multipart/form-data. API integration request is shown below In URL Path Parameters, added bucket as param and directly added the bucket name When I try to upload the file I get an error response, body: '<?xml version="1.0" encoding="UTF-8"?>\n<Error><Code>InvalidArgument</Code><Message>x-amz-content-sha256 must be UNSIGNED-PAYLOAD, STREAMING-AWS4-HMAC-SHA256-PAYLOAD, or a valid sha256 value.<

How to have a working Textarea and a fileUpload in one form

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-07 03:50:55
问题 The Problem The below test case illustrates my issue. I have a JSF application which uses a HTML form in which I must use enctype="multipart/form-data" since I am using a file upload, see here. However when I use this encoding, newlines entered into my Textarea disappear when submitted to the server. The text area in result.xhtml always shows all of the text the user entered on index.xhtml on one line, regardless of any newlines the user put in. The output text always evaluates to "False" to

WebResource multipart post request

五迷三道 提交于 2020-01-07 03:07:19
问题 I need to send post request using java test to this rest function : @RequestMapping(value = "/upload", method = RequestMethod.POST) public @ResponseBody String handleFileUpload(@PathVariable Long ownerId, @RequestBody MultipartFile file, HttpServletResponse response) throws IOException { //Some function } this is my trial: File file = new File("filePath"); FileDataBodyPart fileDataBodyPart = new FileDataBodyPart("file", file, MediaType.MULTIPART_FORM_DATA_TYPE); WebResource webResource =

Square Connect API - image upload - Node.js

与世无争的帅哥 提交于 2020-01-06 07:15:44
问题 I've spent days trying to successfully upload images with the image_upload endpoint using the Square Connect v1 API. The API docs are here Currently, I'm getting the following response after making the POST. {"type":"bad_request","message":"Could not create image"} I'm using the node-request library as such: const formData = { image_data: { value: BASE64IMAGE, options: { 'Content-Disposition': 'form-data', filename: 'hat.jpg', 'Content-Type': 'image/jpeg', }, }, }; request.post( { method: