multipartform-data

How to set my own boundary on multipart/form-data using XMLHttpRequest and FormData object

隐身守侯 提交于 2019-12-08 19:39:32
问题 I have been trying to find out a way to set my own boundary on an XMLHttpRequest object when using the FormData object to append files to a request. I've seen multiple posts on this and everyone says "just don't set the boundary and it will automatically generate for you." This is NOT what I want. Let me explain what I need so I don't get these kinds of responses. I have a web service endpoint to which I send a multipart/form-data request with two images and some json data. Since WCF doesn't

Uploading compress image to server using retrofit

半城伤御伤魂 提交于 2019-12-08 17:03:56
问题 I am using retrofit in my project. Now I need to upload an image on server using retrofit. So I need help in the following question: How to upload compressed bitmap to a server using retrofit in form data? Any link or example will be helpful. 回答1: Upload can be done using below steps Step 1: Create a method with below code UploadPhotoRetroService service = ServiceGenerator.createService(MyActivity.class, "base-url"); TypedFile typedFile = new TypedFile("image/jpeg", new File(imagePath));

Parse a string of multipart data

徘徊边缘 提交于 2019-12-08 16:17:25
问题 I have a string (base64 decoded here) that looks like this: ----------------------------212550847697339237761929 Content-Disposition: form-data; name="preferred_name"; filename="file1.rtf" Content-Type: application/rtf {\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf830 {\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} {\*\expandedcolortbl;;} \margl1440\margr1440\vieww10800\viewh8400\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480

How to PUT multipart/form-data using Spring MockMvc?

自作多情 提交于 2019-12-08 15:58:41
问题 I have controller's method with PUT method, which receives multipart/form-data: @RequestMapping(value = "/putIn", method = RequestMethod.PUT) public Foo updateFoo(HttpServletRequest request, @RequestBody Foo foo, @RequestParam("foo_icon") MultipartFile file) { ... } and I want to test it using MockMvc . Unfortunately MockMvcRequestBuilders.fileUpload creates essentially instance of MockMultipartHttpServletRequestBuilder which has POST method: super(HttpMethod.POST, urlTemplate, urlVariables)

Alamofire Multipart request

做~自己de王妃 提交于 2019-12-08 14:09:17
问题 I am new to swift programming. i am trying do Multipart request via alamofire .Issue is that one of value in my parameters is array of objects. My Question is how to append array of object to Multipart request. Here are my parameters. let parameters = [ "originguid":"63d6sd5", "signees":[Signess], //Here is issue "signees"is an array of objects "customer":"yes" ] as [String : Any] here is my request Alamofire.upload( .POST, URLString: myUrl, multipartFormData: { multipartFormData in if let

Alamofire progress callback stops working after returning from background

*爱你&永不变心* 提交于 2019-12-08 10:45:03
问题 I have a method that uploads (video) data to the server, and it looks like this: static func upload(video data:Data, named name:String, parameters:[String:Any], toUrl url:URL, progress:@escaping (Double)->Void, completion:@escaping(Bool)->Void){ manager = Alamofire.SessionManager(configuration: URLSessionConfiguration.background("com.app.backgroundtransfer") manager.upload(multipartFormData: { (multipartFormData) in multipartFormData.append(data, withName: "filedata", fileName: name, mimeType

Cant post to Azure storage? Invalid Path error

大兔子大兔子 提交于 2019-12-08 09:10:55
问题 I am trying to add an image I am receiving like this. [FunctionName("Imageupload")] public static async System.Threading.Tasks.Task<HttpResponseMessage> RunAsync([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "HttpTriggerCSharp/name/{name}")]HttpRequestMessage req, string name, TraceWriter log) { //Check if the request contains multipart/form-data. if (!req.Content.IsMimeMultipartContent()) { return req.CreateResponse(HttpStatusCode.UnsupportedMediaType); } var

Uploading videos using formdata in react native

一笑奈何 提交于 2019-12-08 08:21:15
问题 Has anyone successfully uploaded a video via React Native Formdata()? The code below attempts to upload a .mov file from the camera roll URI but in fact only the first frame of the video (a JPEG) gets uploaded. What's the issue here? var movVideo = { uri: uriFromCameraRoll, type: 'video/quicktime', name: 'something.mov', }; var body = new FormData(); body.append('video', movVideo); body.append('title', 'A beautiful video!'); fetch('https://mysite/upload_asset', { method: "POST", headers: {

Unexpected end of MIME multipart stream in reading the second time in Web API

我与影子孤独终老i 提交于 2019-12-08 07:39:10
问题 at first step I tried to read the contents into MultipartMemoryStreamProvider with the following code var multipartMemoryStreamProvider = await Request.Content.ReadAsMultipartAsync(); It solve my problem in getting the input File in memory.In this case I have access to other contents Key , but not value . I tried to get them with reading again the Contents into MultipartFormDataStreamProvider variable string root = HttpContext.Current.Server.MapPath("~/uploads"); var provider = new

How can I post photo to facebook with python sdk

*爱你&永不变心* 提交于 2019-12-08 07:37:27
问题 I am using the python SDK on google app engine, and I'm runnig the "newsfeed" example. I tried to change the example code in order to upload local image file to facebook. And follow is my change, but i don't know how to finish it. I'm wondering that how to change facebookclient.py or facebook.py to upload image. Thanks home.html <form action="/post" enctype="multipart/form-data" method="post"> <div class="textbox"><textarea name="message"></textarea></div> <div><input name="image" type="file"