multipartform-data

How to get the real file size of a file in a multipart/form-data request

倾然丶 夕夏残阳落幕 提交于 2019-12-14 01:12:32
问题 As the title says, I need to get the real filesize of a file posted as a multipart/form-data request. I'm based in the JSF world but I think the problem is technology-agnostic (only depends on HTTP). The value specified in the Content-Length header is not sufficient because it includes the boundaries and other form parameters. Example request (body only): -----------------------------355432893771247592819421210 Content-Disposition: form-data; name="composeform" composeform -------------------

Grails Multipart Service Stream ended unexpectedly

若如初见. 提交于 2019-12-13 19:17:01
问题 I'm coding an ios app and I need to send photo from my app to my grails server. In ios i do this: +(void)sendPhoto:(NSData *)data withName:(NSString *)name onController:(UIViewController<MERequestDelegate> *)controller { MERequest *request = [[MERequest alloc] init]; request.delegate = controller; //User User *user = [User loadUser]; //Creazione del BOdy della richiesta Multipart NSMutableData *body = [[NSMutableData alloc] init]; //Token [body appendData:[[NSString stringWithFormat:@"\r\n--%

Is there an API for Mozilla for updating signed addons?

梦想的初衷 提交于 2019-12-13 17:18:16
问题 I have a signed addon that I use personally but would like to experiment with making it distributable via AMO. I have already uploaded the initial version through the Developer Hub, and I'm now hoping to be able to include an automated release through a CI pipeline. I've been investigating how to do this for a while now, having found this article and API doc but haven't had much luck. I'm definitely able to connect with my JWT properly, as I get either a 301 (I assume this is because the API

Sending binary data using multipart/form-data from a worker with IE11

百般思念 提交于 2019-12-13 16:46:48
问题 I'm trying to send a multipart/form-data from a worker with IE. I've already done it with Chrome, Firefox, Safari using formData objects (not supported IE, I need a manual one) The binary data I'm sending is a crypto-js encrypted data. With formData objects I do: var enc = new Buffer(encrypted.ciphertext.toString(CryptoJS.enc.Base64), 'base64'); formData.append("userFile" , new Blob([finalEncrypted], {type: 'application/octet-binary'}), 'encrypted') this works fine generating a multipart like

Multipart form file upload POST PHP cURL

北城余情 提交于 2019-12-13 14:26:24
问题 I am wanting to send a file via http POST using PHP and cURL. The form POST was working ok with basic fields besides the file being posted with 'application/json'. This needs to be multipart/form from what I understand. Error I am getting is Notice: Array to string conversion on line curl_setopt($ch, CURLOPT_POSTFIELDS, $data); If anyone can help that would be great! PHP $orgID = (is_numeric($_POST['orgID']) ? (int)$_POST['orgID'] : 0); $noteTitle = (isset($_POST['noteTitle']) ? $_POST[

Trouble sending a file to Imgur

自古美人都是妖i 提交于 2019-12-13 12:17:37
问题 I'm trying to use the python requests lib to upload an image to Imgur using the imgur api. The api returns a 400, saying that the file is either not a supported file type or is corrupt. I don't think the image is corrupt (I can view it fine locally), and I've tried .jpg , .jpeg , and .png . Here is the code: api_key = "4adaaf1bd8caec42a5b007405e829eb0" url = "http://api.imgur.com/2/upload.json" r = requests.post(url, data={'key': api_key, 'image':{'file': ('test.png', open('test.png', 'rb'))}

How do I POST an array with multipart/form-data encoding?

烂漫一生 提交于 2019-12-13 11:52:49
问题 In a GET parameter string, or an "x-www-form-urlencoded" POST request, it's possible to specify an array of parameters by naming them with brackets (e.g. "name[]"). Is there a "correct" (or at least a wide-spread convention) way to specify an array of parameters with a "multipart/form-data" POST request? Would the following be correct? Content-Type: multipart/form-data; boundary=--abc --abc Content-Disposition: form-data; name="name[]" first index --abc Content-Disposition: form-data; name=

Parse a JSON body after multipart ajax Angular call

风格不统一 提交于 2019-12-13 09:01:17
问题 I'm trying to parse a body that is coming to me after an api call using ajax angularJs. After call the response is: --3531b7e68196e3144197f82db0864b7e391c8b0ad51c4176c28f8ac41b3c Content-Disposition: form-data; name="passport"; filename="passport.json" Content-Type: application/json { "name": "Nothing", "dob_display": "10/11/1997", "dob_accuracy": "FD", "owner_firstname": "Nothing", "owner_surname": "To Understand" } --3531b7e68196e3144197f82db0864b7e391c8b0ad51c4176c28f8ac41b3c-- I didn't

How to post multi-part/form images with string parameter in android

浪尽此生 提交于 2019-12-13 07:36:36
问题 I have an API which has a payload body of type String. But has both json and image (multiparty/form) as part of the payload body. Something like this: json={jsonbody} image=@images/testing.png This is what i am doing currently public static String uploadImageQuery(Context context, String urlString, String method, JSONObject jsonObject, Bitmap largeImageBitmap, Dialog dialog) throws IOException { String responseString = null; HttpURLConnection conn = null; URL url = new URL(urlString); conn =

NSURLConnection and bound pair of streams (CFStreamCreateBoundPair or CFStreamCreateBoundPairCompat) not working on iPhone 3G

蓝咒 提交于 2019-12-13 05:41:26
问题 I'm using SimpleURLConnections example to implement multipart/form-data POST request using bound pair of streams. It works great in Simulator and on iPhone 3GS/iPhone 4. When I try it on iPhone 3G (running 3.1.3) no data gets sent to the server. NSURLConnection just keeps hanging until it times out. After some testing I figured that the problem only occurs when I write to the producer stream more than once per connection. Whenever I need to write more than once (that is when I have to respond