multipartform-data

Javascript XHR send multipart/form-data

我是研究僧i 提交于 2019-12-30 05:04:07
问题 I'm trying to send a multipart/form-data content-type request: var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if(xhr.readyState==4){ alert(xhr.responseText); } } xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type","multipart/form-data; boundary=---------------------------275932272513031"); xhr.send('-----------------------------275932272513031 Content-Disposition: form-data; name="name" test ----------------------------275932272513031--'); Then in php I just

Can't find @FormDataParam in Jersey 2.17

 ̄綄美尐妖づ 提交于 2019-12-30 03:43:14
问题 I'm quite new to web services so I've started with basic examples. This one relates to file upload. I'm using latest (2.17) version of Jersey bundle for non-maven developers. It states that: bundle contains the JAX-RS 2.0 API jar, all the core Jersey module jars as well as all the required 3rd-party dependencies . The problem is that I can not compile this part: @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFile( @FormDataParam("file") InputStream

How to sent a POST request with form-data and parameters in PL/SQL

流过昼夜 提交于 2019-12-29 09:19:12
问题 I'm trying to call REST WebService in PL/SQL but it doesn't work. I get this error: Content-type must be multipart/form-data Here is what I have: DECLARE req UTL_HTTP.REQ; resp UTL_HTTP.RESP; value VARCHAR2(1024); -- URL to post to v_url VARCHAR2(200) := 'http://local/api/ws'; -- Post Parameters v_param VARCHAR2(500) := 'art=11111\&qty=1'; v_param_length NUMBER := length(v_param); BEGIN req := UTL_HTTP.BEGIN_REQUEST (url=> v_url, method => 'POST'); UTL_HTTP.SET_HEADER(req, 'User-Agent',

How to submit multiple entities to the post method from jersey client program?

时光毁灭记忆、已成空白 提交于 2019-12-29 08:58:09
问题 I am trying to pass multiple entities to the web service method. The web service method has two parameters of pojo entity type. I am able to post only one entity to the web service method. I am unable to post multiple entities to the web service method. Server side code: @POST @Path("/test") @Produces(MediaType.APPLICATION_XML) @Consumes(MediaType.APPLICATION_XML) public void testMethod(Emp emp, Student stud){ ... } Client side code: ... ... Emp emp = new Emp; Student stud = new Student();

Sending files /file upload using ajax which works in IE9

◇◆丶佛笑我妖孽 提交于 2019-12-29 04:47:12
问题 I need to upload files using ajax which has to be supported in IE9. I was using FormData as mentioned here. My code looks like this: var files = new FormData(); JQuery.each($('#file')[0].files, function (i, file) { files.append('file', file); }); $.ajax({ type: "POST", url: '/url', cache: false, contentType: false, processData: false, data: files, ... }); This works fine in Safari and Firefox, but fails in IE9 as the FormData is not supported in IE9. I tried sending just as a file by setting:

Library and examples of parsing multipart/form-data from inputstream

橙三吉。 提交于 2019-12-28 16:08:10
问题 The response to one kind of HTTP request I send is a multipart/form-data looks something like: --------boundary123 Content-Disposition: form-data; name="json" Content-Type: application/json {"some":"json"} --------boundary123 Content-Disposition: form-data; name="bin" Content-Type: application/octet-stream <file data> --------boundary123 I've been using apache to send and receive the HTTP requests, but I can't seem to find an easy way to use it to parse the above for easy access of the form

struts2 file upload loosing parameters

眉间皱痕 提交于 2019-12-28 04:31:26
问题 Using Struts 2.3.15.1 Implementing file upload in struts2. This is something I've done a number of times, however, I'm trying to include some sanity checks (i.e. max file size primarily). I have the fileUpload interceptor in place as the last interceptor in my stack (i.e. struts.xml ). My stack includes a few in-house interceptors as well as the validationWorkflowStack . I've set the following property in my struts.properties file: struts.multipart.maxSize = 2000000 In addition to the file

File Upload using HTTPHandler

自作多情 提交于 2019-12-28 03:10:20
问题 I am trying to upload file ( multi part form data ) using HTTPHandler. WebKit Boundary is getting written to the destination file , thus corrupting the file. Input files can be any kind of files, including text, zip, apk etc. Code: public void handle(HttpExchange httpExchange) throws IOException { URI uri = httpExchange.getRequestURI(); String httpReqMethod = httpExchange.getRequestMethod(); Headers headers = httpExchange.getRequestHeaders(); InputStream inputStrm = null; FileOutputStream

Retrofit Uploading multiple images to a single key

随声附和 提交于 2019-12-28 01:48:11
问题 I am using Retrofit to upload images to my server. Here I need to upload multiple images for a single key. I have tried with Postman web client it is working well. Here is a screenshot. Here are the key value pairs for the request. SurveyImage : [file1,file2,file3]; PropertyImage : file DRA : jsonBody I tried to do the same with Retrofit. but the images are not uploading to the server.Here is my code. WebServicesAPI.java public interface WebServicesAPI { @Multipart @POST(WebServices.UPLOAD

jQuery AJAX 'multipart/form-data' Not Sending Data?

天涯浪子 提交于 2019-12-27 22:12:36
问题 I'm at a loss for why I can't get jQuery to pass upload data seeing as the AJAX object appears to be configured correctly, and the correct Content-Type/MIME-Type headers are being sent. I've tried two separate forms of request--one with a FormData object contained within a literal, and also just passing the FormData object directly. Unfortunately either way I can't get anything to pass, and both $_FILES and $_POST are empty arrays. The ideal request I wish to use is as follows: Along with the