multipartform-data

Cannot POST multipart data from retrofit 2

烂漫一生 提交于 2019-12-05 05:41:26
I have to send a post request in this format. --__X_PAW_BOUNDARY__ Content-Disposition: form-data; name="user_photo[image]"; filename="file.jpg" Content-Type: image/jpeg ÿØÿàJFIFHHÿáLExifMM*i ÿí8Photoshop 3.08BIM8BIM%ÔÙ²é ìøB~ÿÀ "ÿÄ ÿĵ}!1AQa"q2¡#B±ÁRÑð$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øùúÿÛC ÿÛC ÿÝZÿÚ?ü_¢+þæð¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(

Uploading multiple files with Fetch and FormData APIs

北战南征 提交于 2019-12-05 05:37:13
I'm trying to use the native Fetch and FormData APIs to upload multiple files at once to the server but I can't for the life of me get it to work. Here's what I've got: // acceptedFiles are File objects coming from `react-dropzone`. function handleSubmit(acceptedFiles) { const data = new FormData(); for (const file of acceptedFiles) { data.append('files', file, file.name); } return fetch('https://example.com/api/upload', { method: 'POST', body: data, }); } But what my Rails server receives is this: Parameters: {"files"=># <ActionDispatch::Http::UploadedFile:0x00007feb347becc0 @tempfile=#

How to post multipart/form-data from Angular to Nodejs Multer?

我是研究僧i 提交于 2019-12-05 04:44:10
From Angular I want to upload a image as Blob data to nodeJS server. The server uses multer in the backend. The image file is generated by canvas render. I am getting the following error from the server: Error: Multipart: Boundary not found status:500 The following is my code. Please help me to find out the issue. Angular: // blob:Blob; -> it has valid image data. var formData: FormData = new FormData(); formData.append('banner', blob, "my-file.png") this.http.post(url, formData, { headers: new Headers({ 'Content-Type': 'multipart/form-data' }) }) .toPromise() .then(res => { console.log(res);

Curl post with multipart/form-data and JSON

穿精又带淫゛_ 提交于 2019-12-05 04:27:11
Is there a way to use curl to do a multipart/form-data post and specify that the data is application/json ? It doesn't have to be curl. This is what I use, and it works fine curl -v -H "Content-Type:multipart/form-data" -F "someName={\"your\":\"json\"};type=application/json" Note: I'm on Windows, hence the requirement for double quotes Or -F "someName=@someJsonFile.json;type=application/json" 来源: https://stackoverflow.com/questions/29563907/curl-post-with-multipart-form-data-and-json

Selecting multiple files and uploading them using Jersey

为君一笑 提交于 2019-12-05 02:33:43
问题 I need help with multiple file uploads using Jersey. I used the following code to upload a single file using Jersey. package my.first.rest; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.ws.rs.Consumes; import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.MediaType; import com.sun.jersey.core.header.FormDataContentDisposition; import com

cURL with Alamofire - Swift - multipart/form-data

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 02:25:48
问题 First, im sorry if this question is stupid but im pretty new to this stuff. I've tried different things to create the swift equivalent of this cURL request with Alamofire, but I don't know how to send the image as a multipart/form-data to the API. curl -X POST -F "file=@/Users/nicolas/sample.png" -F "mode=document_photo" https://api.idolondemand.com/1/api/sync/ocrdocument/v1 -F "apikey=xxx-xxx-xxx-xxx-xxx" I think current code is pretty wrong for this type of request, but still i'm gonna post

ASP.NET MVC. How to create Action method that accepts and multipart/form-data

限于喜欢 提交于 2019-12-05 02:13:42
I have a Controller method that needs to accept multipart/form-data sent by the client as a POST request. The form data has 2 parts to it. One is an object serialized to application/json and the other part is a photo file sent as application/octet-stream . I have a method on my controller like this: [AcceptVerbs(HttpVerbs.Post)] void ActionResult Photos(PostItem post) { } I can get the file via Request.File without problem here.However the PostItem is null. Not sure why? Any ideas Controller Code: /// <summary> /// FeedsController /// </summary> public class FeedsController :

Mule http:outbound-endpoint + multipart/form-data

浪尽此生 提交于 2019-12-04 20:32:51
I'm trying to call a rest service that expects to receive a multipart/form-data and I am facing some issues with this. After a while searching, I've understood that I had to move the payload to an outbound attachment and set the payload to null. <expression-component><![CDATA[ ds = new org.mule.message.ds.StringDataSource(formdata,'payload','multipart/form-data'); dh = new javax.activation.DataHandler(ds); message.outboundAttachments['payload'] = dh; ]]></expression-component> <set-payload value="#[null]" /> I've also done that, but got the error: I received a content-type error: Message :

IE 11: Error while sending Multipart Form Data request: Stream ended unexpectedly

会有一股神秘感。 提交于 2019-12-04 19:57:04
问题 I am trying to upload files along with some other form fields using jQuery AJAX calls. This is a common function that calls the URL on the server: function uploadDocument(rquestURL,formId,callback){ $.ajax({ type : 'POST', url : rquestURL, cache:false, processData:false, contentType:false, data : new FormData($("#"+formId)[0]) }).done(function(response) { callback(response); }); } On examining from the dev tools from browsers, these are the respective request contents: From IE11 -------------

Upload image through form data using python requests

爷,独闯天下 提交于 2019-12-04 19:49:07
I am trying to automate uploading of images. When I upload an image in the browser and look at the network tab I see te following in request body: ------WebKitFormBoundary053SrPeDVvrnxY3c Content-Disposition: form-data; name="uploadId" 0:0:48deedc5937d0:1009c3 ------WebKitFormBoundary053SrPeDVvrnxY3g Content-Disposition: form-data; name="mtype" 1000 ------WebKitFormBoundary053SrPeDVvrnxY3g Content-Disposition: form-data; name="extensions" png,gif ------WebKitFormBoundary053SrPeDVvrnxY3g Content-Disposition: form-data; name="minPixSize" 1000 ------WebKitFormBoundary053SrPeDVvrnxY3g Content