multipartform-data

Posting `multipart/form-data` with Flurl

筅森魡賤 提交于 2019-12-05 14:33:35
I am in need to post the following request: POST http://target-host.com/some/endpoint HTTP/1.1 Content-Type: multipart/form-data; boundary="2e3956ac-de47-4cad-90df-05199a7c1f53" Accept-Encoding: gzip, deflate Connection: Keep-Alive Content-Length: 6971 Host: target-host.com --2e3956ac-de47-4cad-90df-05199a7c1f53 Content-Disposition: form-data; name="some-label" value --2e3956ac-de47-4cad-90df-05199a7c1f53 Content-Disposition: form-data; name="file"; filename="my-filename.txt" <file contents> --2e3956ac-de47-4cad-90df-05199a7c1f53-- I can do this really easily with Python requests library as

How do I make soapUI attachment paths relative?

强颜欢笑 提交于 2019-12-05 14:16:04
I'm using soapUI to test an HTTP server. I need to send a multipart/form-data request, and the request works fine when I go through the file chooser and attach it, but it's saving the path as an absolute path, and I need to save a path relative to my test file (but not cached IN my test file). How can I do this? FYI, I'm using SoapUI 4.0.1 free edition and I am willing to using a groovy coding step if I could figure out how to access the attachment path from it. OK, I solved this by adding a groovy coding step. Took a while to navigate the API, so documenting it here for others. testFile = new

How to read a Multipart file as a string in Spring?

独自空忆成欢 提交于 2019-12-05 14:03:17
问题 I want to post a text file from my desktop using Advanced Rest Client. This is my controller: @RequestMapping(value = "/vsp/debug/compareConfig/{deviceIp:.*}", method = RequestMethod.POST, consumes = { "multipart/form-data" }, produces = { "application/json" }) public ResponseEntity<SuccessResult> compareCLIs(HttpServletRequest request, @RequestParam("file") MultipartFile file, @PathVariable("deviceIp") String device) { log.info(file.getOriginalFilename()); byte[] bytearr = file.getBytes();

Equivalent of “curl -F” parameter for System.Net.Http.MultipartFormDataContent?

扶醉桌前 提交于 2019-12-05 11:57:09
I am trying to use the sonicAPI file/upload API in C#. My attempt to translate the curl example to C# with HttpClient and MultipartFormDataContent returns the error 400 / Bad Request . Content of the response : <?xml version="1.0" encoding="UTF-8"?> <response> <status code="400" /> <errors> <error message="File upload failed: file is missing." parameter="file" error_code="10" /> </errors> </response> Example of the curl command-line shown in the documentation : curl https://api.sonicapi.com/file/upload?access_id=$ACCESS_ID -Ffile=@Vocals.mp3 Code I've crafted so far : public async Task

HTTPBuilder and MultipartEntity / multipart form-data in Groovy

我只是一个虾纸丫 提交于 2019-12-05 11:04:20
Trying to simulate a HTTP POST that needs to combine some INPUT/TEXT fields along with data from a file. It looks like I can have one or the other, but not both? In the snippet below, paramsToPost = [name: 'John', age:22] @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.0') Boolean doHttpPost(String url, Map paramsToPost, String fileContent) { HTTPBuilder http = new HTTPBuilder(url) def resp = http.request(Method.POST ) { req -> MultipartEntity mpe = new MultipartEntity() mpe.addPart "foo", new StringBody(fileContent) req.entity = mpe // body =

Retrofit for android @Multipart remove default headers

倾然丶 夕夏残阳落幕 提交于 2019-12-05 10:50:46
Making a @Multipart request adds these default headers (Content-Transfer-Encoding, Content-Type) for each part, is there any way to remove them? //REQUEST BODY --25d35373-d2c3-46a3-969f-f5a1fd5f781a Content-Disposition: form-data; name="client_id" Content-Transfer-Encoding: binary <-- remove this one Content-Type: application/json; charset=UTF-8 <-- remove this one Content-Length: 34 "40ccfee680a844780a41fbe23ea89934" // NOTE: I do not have access to the server so there is no way I will be able to make the server accept these headers. You can build multipart body by your self in this way

upload image from ipad app to node js server using multiparty

限于喜欢 提交于 2019-12-05 10:30:15
I am very new to javascript and node js. I am working on uploading image from my iPad app to rest api of node js(express js) using multiparty module. Here is my image upload code in objective c. NSData *imgData = UIImageJPEGRepresentation(img.image, 0.2); NSString *urlString = @"http://localhost:3000/api/uploadimage"; NSString *str = @"displayImage"; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; [request setHTTPShouldHandleCookies:NO]; [request setTimeoutInterval:30]; [request setURL:[NSURL URLWithString

Parsing multipart/form-data using Apache Commons File Upload

家住魔仙堡 提交于 2019-12-05 09:41:16
Does Apache Commons File Upload package provides a generic interface to stream parse multipart/form-data chunks via InputStream , appending Array<Byte> , or via any other generic streaming interface? I know they have a streaming API but the example only shows you how to do that via ServletFileUpload , which I reckon must be specific to Servlet . If not, are there any other alternative frameworks in JVM that lets you do exactly this? Sadly, the framework that I am using, Spray.io, doesn't seem to provide a way to do this. bayou.io has a generic MultipartParser You might need some adapters to

How to create an AWS Lambda/API gateway python function that takes a pdf file as input using multipart/form-data?

徘徊边缘 提交于 2019-12-05 09:06:45
问题 I have been struggling with this for a while now. I need to create a resource in API gateway linking to a lambda function that takes a pdf file as input sent as a multipart/form-data POST request. To make it simple, I am just returning the file for now. When I try to call the API with the following curl, I get Internal server error from AWS. Did anyone ever succeeded to send a pdf file to Lambda without having to use the S3 trick (upload to S3)? Thank you all in advance for any hint. Commands

Using node and restler for multipart form-data POST

我是研究僧i 提交于 2019-12-05 07:42:05
问题 I am able to upload a file using restler.file in the data section with no problem. I am now trying to write a very short CSV data string, which I am not able to find documentation for the data function, but reading the code I thought I had it correct: restler.post("http://posttestserver.com/post.php", { multipart: true, data: { "upload": restler.data("people.csv", "text/csv", '384;213;Status Update'), "returnURL": "" } }).on("complete", function(data) { console.log(data); }); Unfortunately