multipartform-data

How to resolve MethodArgumentConversionNotSupportedException with MockMvc?

爷,独闯天下 提交于 2019-12-11 13:18:54
问题 I'm writing a unit test for a controller method that accepts a MultipartFile and a custom object MessageAttachment . So far I can see that the MultipartFile is the correct format for the request but the MessageAttachment is not. The parsing of the messageAttachment throws a server side 500 error with MethodArgumentConversionNotSupportedException . It seem to be an issue with converting the MessageAttachment to a MockMultipartFile in the test. This is similar to the example shown here - https:

getting Java Bad File Descriptor Close Bug while reading multipart/form-data http body

自古美人都是妖i 提交于 2019-12-11 11:30:13
问题 My web service hosted on Play! framework. I have few image files uploaded from a non-play! framework based client using the standard HTTP client request with content-type of multipart/form-data. On the web service side, I tried using Play! ApacheMultipartParser to parse the Http.request.body, but failed with the Java IO Bad File Descriptor exception. The problem seems come from Java MultipartStream, by looking at the following callstack at java.io.FileInputStream.readBytes(Native Method) at

Multipart form not working in Rails

╄→尐↘猪︶ㄣ 提交于 2019-12-11 11:11:54
问题 I have been trying to create a multi-part form in Rails for the last day, which is crazy, but I am really not sure how to get around this one. Currently, here is the code in my view: <%= form_for @account, :html => {:multipart => true } do |f| %> However, the HTML returned is as follows: <form accept-charset="UTF-8" action="/accounts/1" class="edit_account" id="edit_account_1" method="post"> For the life of me I can't figure out why the form is not showing up as a multi-part. This particular

python CGI : upload error

假装没事ソ 提交于 2019-12-11 11:02:46
问题 I use Python version 3.4 and this is server source code in python import io from socket import * import threading import cgi serverPort = 8181 serverSocket = socket(AF_INET, SOCK_STREAM) serverSocket.bind(('', serverPort)) serverSocket.listen(5) def serverHandle(connectionSocket, addr): try: message = connectionSocket.recv(1024) if not message: return path = message.split()[1].decode('utf-8') if path == '/': connectionSocket.send(b'HTTP/1.1 200 OK\r\n') connectionSocket.send(b'Content-type:

Apache Camel multipart route

旧街凉风 提交于 2019-12-11 10:36:51
问题 I'm trying to route a file to HTTP file upload API via Apache Camel. But I'm getting following exception org.apache.camel.InvalidPayloadException: No body available of type: java.io.InputStream but has value: org.apache.http.entity.mime.MultipartFormEntity@71ef4d4f of type: org.apache.http.entity.mime.MultipartFormEntity on: org.apache.camel.component.file.GenericFileMessage@7e693963. Caused by: No type converter available to convert from type: org.apache.http.entity.mime.MultipartFormEntity

multipart POST with Chef http_request resource

≯℡__Kan透↙ 提交于 2019-12-11 10:23:33
问题 Is there a way to do a multipart post with the Chef http_request resource? I have something like the following which posts the file contents, but I need to post form data along with it. http_request 'post_file_and_form_data' do headers ({'Content-Type' => 'multipart/form-data'}) url "http://myhost:2000/myapp/upload" action :post message lazy { ::File.read("/somewhere/myFile.yaml") } end 回答1: I'm not sure this is supported in the underlying Ruby standard library ( Net::HTTP ). I've seen most

How can I simultaneously pass args and upload a file to a Web API Controller Method?

こ雲淡風輕ζ 提交于 2019-12-11 10:18:23
问题 I decided that my question here isn't really what I want to do - the XML I need to send is a lot longer, potentially, than I really want to send in a URI. It didn't "feel" right doing that, and this unsealed the deal. I need to send both a couple of args AND a file to my Web API app from a client (handheld/CF) app. I may have found the code for receiving that, from here [ http://www.asp.net/web-api/overview/working-with-http/sending-html-form-data,-part-2] Specifically, Wasson's Controller

How to send Photos to server with additional fields in Android app?

若如初见. 提交于 2019-12-11 10:10:00
问题 I try to send multiple photos to server with Retrofit. I have endpoint like this: @Multipart @POST("/v1/props") Call<ModelProp> createProp( @Header("x-auth") String token, @Part List<MultipartBody.Part> photo ); But I don't know how to add to this POST method additional information with: int price; String currency; ArrayList<String> tags; Can someone help me add this fields to POST with retrofit? edit: Array may have 1000+ elements 回答1: In Retrofit 2, You can send it extra data with the image

Sending a FormData object to server with Ajax (contains files)

感情迁移 提交于 2019-12-11 09:59:37
问题 I have a form that has both text and file fields. I am trying to submit the whole thing to a php script hosted on the server, and return a validation message. My form looks like this: <form id="ambassador" method="post" enctype="multipart/form-data"> <label for="name">Name: </label> <input type="text" id="name"> <br /> <label for="age">Age: </label> <input type="number" id="age"> <br /> <label for="igram">Instagram Account: </label> <input type="text" id="igram"> <br /> <label for="photo"

Processing multipart/form-data in Perl invokes Apache-error with Apple-devices, when a form-file-element is empty

萝らか妹 提交于 2019-12-11 09:52:03
问题 My application is written in Perl 5.14.2. I process multipart/form-data with use CGI; $query = new CGI; Since a few weeks this process invokes a timeout at Apache-level on specific Apple-devices: (70007)The timeout specified has expired: Error reading request entity data The apple-devices that invoke the timeout-error all do have Applewebkit/605 in common. This is mostly a Safari browser version 11 on a Mac. The formdata is send through: var fData = new FormData($('#myForm')[0]); jQuery.ajax(