multipartform-data

Python equivalent to curls --form: Create multipart form-data post request with data in “form” parameter

感情迁移 提交于 2019-12-09 18:40:51
问题 I'm looking for a python equivalent to this curl command: curl --referer "https://myreferer" --insecure --form "myparam=1234" https://myurl which results in the following request (taken from httpbin.org/post): { "args": {}, "data": "", "files": {}, "form": { "myparam": "1234" }, "headers": { "Accept": "*/*", "Connection": "close", "Content-Length": "142", "Content-Type": "multipart/form-data; boundary=----------------------------29a1ce32cc53", "Host": "httpbin.org", "Referer": "https:/

Spring REST - Can a RestTemplate consume multipart/mixed?

回眸只為那壹抹淺笑 提交于 2019-12-09 18:34:00
问题 I want to write a REST service which does responed with a zipFile and some json data, everything in one multipart/mixed request. The server part works fine and i am testing it with the REST Client from firefox. My Server sends a multipart like this --k-dXaXvCFusLVXUsg-ryiHMmkdttadgcBqi4XH Content-Disposition: form-data; name="form" Content-type: application/json {"projectName":"test","signal":"true"} --k-dXaXvCFusLVXUsg-ryiHMmkdttadgcBqi4XH Content-Disposition: form-data; name="file2";

File Upload with Additonal Form Data to Web Api from MVC

你说的曾经没有我的故事 提交于 2019-12-09 16:46:59
问题 I am trying to upload a file with additional form data and post to Web API via MVC but i couldn't accomplish. MVC Side Firstly i got the submitted form at MVC. Here is the action for this. [HttpPost] public async Task<ActionResult> Edit(BrandInfo entity) { try { byte[] logoData = null; if(Request.Files.Count > 0) { HttpPostedFileBase logo = Request.Files[0]; logoData = new byte[logo.ContentLength]; logo.InputStream.Read(logoData, 0, logo.ContentLength); entity.Logo = logo.FileName; entity =

How can I See the content of a MultipartForm request?

寵の児 提交于 2019-12-09 14:43:22
问题 I am using Apache HTTPClient 4. I am doing very normal multipart stuff like this: val entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart("filename", new FileBody(new File(fileName), "application/zip").asInstanceOf[ContentBody]) entity.addPart("shared", new StringBody(sharedValue, "text/plain", Charset.forName("UTF-8"))); val post = new HttpPost(uploadUrl); post.setEntity(entity); I want to see the contents of the entity (or post, whatever) before I send it.

unable to upload file using NSURLSession multi-part form data in iOS

走远了吗. 提交于 2019-12-09 14:27:37
问题 I am trying to upload a video / image file using - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromFile:(NSURL *)fileURL; method using multi-part form data. But somehow i am not able to upload the file and i am getting " stream ended unexpectedly " error. Requirements Upload a video / image file to server App should support background uploads (Continue the upload process even after app goes into background) Server expects the data to be sent using multi-part form

Multipart File Upload:Size exceed exception in spring boot return JSON error message

孤者浪人 提交于 2019-12-09 13:30:25
问题 As I have set maximum file upload limit,I am getting org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 2097152 bytes error while uploading file.It is giving 500 error to my api,I should I handle this error and return response in JSON format not an errorpage as provided in ErrorController I want to catch that exception and give JSON response not ErrorPage . @RequestMapping(value="/save",method

Programmatic access to MultiPartConfig in Servlet 3.0

北城余情 提交于 2019-12-09 12:16:25
问题 I use Servlet 3 @MultiPartConfig annotation to implement file upload in my application. I need set multipart-config location parameter at the runtime (not hardcode in annotaion parameter). Is there any API for programmatic access to multipart-config of servlet? Thanks 回答1: The @MultiPartConfig is really just a marker interface for the container. When the servlet is initialized the annotation values provided are mapped to it with a proxy object. When the incoming request is a multipart/form

Fetch API and multer error while uploading file

江枫思渺然 提交于 2019-12-09 05:43:17
问题 I'm trying to use fetch API to upload files to a node.js server (I'm using github's pollyfill if it has something to do with it: https://github.com/github/fetch). The request is done like this: const data = new FormData(); data.append('file', file); return fetch(this.concatToUrl(url), { method: 'post', headers: Object.assign({}, this.getHeaders(), {'Content-Type': 'multipart/form-data'}), body: data, }); On the server side I have, this declaration of route: app.post('/media', upload.single(

ActionDispatch::Http::UploadedFile.content_type not being initialized in Rspec test

北战南征 提交于 2019-12-09 04:19:50
问题 Background : I have a Book model with a cover_file attribute that gets set with an uploaded file via one of my Rails controllers. I'm using Rails v4.0.4. Goal : I want to test that only files with certain content types get saved. I plan to create Rspec test examples with ActionDispatch::Http:UploadedFile objects set with different content_type attributes. Problem : When I initialize a new ActionDispatch::Http::UploadedFile with a content_type , it doesn't seem to get set (see test & output

multipart/form-data, what is the default charset for fields?

自闭症网瘾萝莉.ら 提交于 2019-12-09 02:40:00
问题 what is the default encoding one should use to decode multipart/form-data if no charset is given? RFC2388 states: 4.5 Charset of text in form data Each part of a multipart/form-data is supposed to have a content- type. In the case where a field element is text, the charset parameter for the text indicates the character encoding used. For example, a form with a text field in which a user typed 'Joe owes <eu>100' where <eu> is the Euro symbol might have form data returned as: --AaB03x content