multipartform-data

ServletFileUpload#parseRequest(request) returns an empty list

*爱你&永不变心* 提交于 2019-11-26 20:44:49
问题 I have a client application in Android which uses HttpURLConnection to send files to the server. The server uses the Apache Commons FileUpload API to parse the form-data values. The HttpURLConnection sends this request: -----------------------------4912995119421 Content-Disposition: form-data; name="deviceid" 9428103 -----------------------------4912995119421 Content-Disposition: form-data; name="countryid" 598 -----------------------------4912995119421 Content-Disposition: form-data; name=

Parsing multipart form data

僤鯓⒐⒋嵵緔 提交于 2019-11-26 20:34:55
问题 I'm trying to put together a HTML POST-ed form that has two fields--a file upload, and a text field. Since the form has a type multipart/form-data for the file upload, I can't get at the text field through the normal PHP $_POST variable. So how can I get at the text field in the form with PHP? As per requested, here's some code, basically taken directly from Andrew: <html> <body> <form action="test2.php" method="post" enctype="multipart/form-data"> Name: <input type="text" name="imageName" />

Send FormData with other field in Angular

耗尽温柔 提交于 2019-11-26 20:29:29
I have a form with two input text and one upload . I have to send it to the server but I have some problem concatenating the file with the text. The server expects this answer: "title=first_input" "text=second_input" "file=my_file.pdf" This is the html : <input type="text" ng-model="title"> <input type="text" ng-model="text"> <input type="file" file-model="myFile"/> <button ng-click="send()"> This is the Controller : $scope.title = null; $scope.text = null; $scope.send = function(){ var file = $scope.myFile; var uploadUrl = 'my_url'; blockUI.start(); Add.uploadFileToUrl(file, $scope.newPost

Are there any multipart/form-data parser in C# - (NO ASP)

一笑奈何 提交于 2019-11-26 19:54:56
问题 I am just trying to write a multipart parser but things getting complicated and want to ask if anyone knows of a ready parser in C#! Just to make clear, I am writing my own "tiny" http server and need to pars multipart form-data too! Thanks in advance, Gohlool 回答1: I open-sourced a C# Http form parser here. This is slightly more flexible than the other one mentioned which is on CodePlex, since you can use it for both Multipart and non-Multipart form-data , and also it gives you other form

How to send multipart/form-data with Retrofit?

假装没事ソ 提交于 2019-11-26 19:43:25
问题 I want to send an Article from and Android client to a REST server. Here is the Python model from the server: class Article(models.Model): author = models.CharField(max_length=256, blank=False) photo = models.ImageField() The following interface describes the former implementation: @POST("/api/v1/articles/") public Observable<CreateArticleResponse> createArticle( @Body Article article ); Now I want to send an image with the Article data. The photo is not part of the Article model on the

Angularjs how to upload multipart form data and a file?

我怕爱的太早我们不能终老 提交于 2019-11-26 19:37:17
I'm a beginner to angular.js but I have a good grasp of the basics. What I am looking to do is upload a file and some form data as multipart form data. I read that this isn't a feature of angular, however 3rd party libraries can get this done. I've cloned angular-file-upload via git, however I am still unable to post a simple form and a file. Can someone please provide an example, html and js of how to do this? Prasad Shinde First of all You don't need any special changes in the structure. I mean: html input tags. <input accept="image/*" name="file" ng-value="fileToUpload" value="{

Convert JS Object to form data

一世执手 提交于 2019-11-26 18:52:16
问题 How can I can convert my JS Object to FormData ? The reason why I want to do this is, I have an object that I constructed out of the ~100 form field values. var item = { description: 'Some Item', price : '0.00', srate : '0.00', color : 'red', ... ... } Now I am asked to add the upload file functionality to my form which, of-course is impossible via JSON and so I am planning on moving to FormData . So is there any way that I can convert my JS object to FormData ? 回答1: If you have an object,

How do I set multipart in axios with react?

ぐ巨炮叔叔 提交于 2019-11-26 18:49:08
When I curl something, it works fine: curl -L -i -H 'x-device-id: abc' -F "url=http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" http://example.com/upload How do I get this to work right with axios? I'm using react if that matters: uploadURL (url) { return axios.post({ url: 'http://example.com/upload', data: { url: url }, headers: { 'x-device-id': 'stuff', 'Content-Type': 'multipart/form-data' } }) .then((response) => response.data) } This doesn't work for some reason. Here's how I do file upload in react using axios import React from 'react' import axios, { post } from 'axios'; class

Browser support of multipart responses

穿精又带淫゛_ 提交于 2019-11-26 18:40:57
I would like to create a HTTP response, using multipart/mixed, but I'm not sure which browsers support it; and if it's as convenient as it sounds, from the client's point of view. To be honest, I do not need specifically that content type. I just want to transmit more than one file in the same response; maybe there's another content-type more used. Diego Jancic I've tested it, with a home-made server and a simple response. Not sure if the response is well-formed because no browser understands it 100% OK. But here are the results: Firefox 67.0.1 (64-bit) : Renders only the last part, others are

Retrofit - Multipart request: Required MultipartFile parameter 'file' is not present

北城以北 提交于 2019-11-26 17:44:51
I'm trying to send file on server using Retrofit2. I do everything according documentation, but always get 400 server error. I'm tried to do like this: RequestBody body = RequestBody.create(MediaType.parse("image/png"), photo); //.......... @Multipart @POST(ADD_PHOTO) Observable<HPSPhotoResponse> addPhoto(@Part("file") RequestBody file); ...and like this: MultipartBody.Part part = MultipartBody.Part.createFormData("file", "file", body); //........... @Multipart @POST(ADD_PHOTO) Observable<HPSPhotoResponse> addPhoto(@Part("file") MultipartBody.Part files); does't matter. Result is always the