form-data

Uploading FormData from Trigger.io Forge to Amazon S3

百般思念 提交于 2019-12-03 20:07:59
I am trying to upload an image file from my Trigger.io mobile app directly to Amazon S3 (see here: http://aws.amazon.com/articles/1434 ). I'm able to do this on the web without any problems using jQuery and the FormData API as follows: var fd = new FormData(); key = 'test.jpg' fd.append('key', key); fd.append('acl', 'public-read'); fd.append('Content-Type', file.type); fd.append('AWSAccessKeyId', key_id); fd.append('policy', policy_base64); fd.append('signature', signature); fd.append('file', file); $.ajax({ type: 'POST', url: 'https://' + bucket + '.s3.amazonaws.com/', processData: false, //

How can my Servlet receive parameters from a multipart/form-data form?

百般思念 提交于 2019-12-03 17:25:32
I have a page that has this piece of code: <form action="Servlet" enctype="multipart/form-data"> <input type="file" name="file"> <input type="text" name="text1"> <input type="text" name="text2"> </form> When I use request.getParameter("text1"); in my Servlet it shows null. How can I make my Servlet receive the parameters? All the request parameters are embedded into the multipart data. You'll have to extract them using something like Commons File Upload: http://commons.apache.org/fileupload/ Use getParts() qiangbro Pleepleus is right, commons-fileupload is a good choice. If you are working in

formData object not working with jquery AJAX post?

烂漫一生 提交于 2019-12-03 12:42:59
问题 lets jump right into the code : var formData = new FormData(); formData.append('name', dogName); formData.append('weight', dogWeight); formData.append('activity', dogActivity); formData.append('age', dogAge); formData.append('file', document.getElementById("dogImg").files[0]); console.log(formData); Here I am appending some strings and one file object to the formData object in order to send all the information asynchronous to the server. Right after that I have this jquery ajax request : $

Error: invalid json with multer and body-parser

天大地大妈咪最大 提交于 2019-12-03 12:25:21
问题 I am currently using multer for multipart/form-data in node.js application alongside with body-parser. I tried to POST form-data using POSTMAN, but it is getting this error. Error: invalid json at parse (/Users/k/Documents/application/node_modules/body-parser/lib/types/json.js:79:15) at /Users/k/Documents/application/node_modules/body-parser/lib/read.js:102:18 at IncomingMessage.onEnd (/Users/k/Documents/application/node_modules/body-parser/node_modules/raw-body/index.js:136:7) at

FormData vs .serialize(), What is the difference?

岁酱吖の 提交于 2019-12-03 10:31:54
问题 Recently I was submitting a form using AJAX. In researching the best method I saw some AJAX submissions using .serialize() and others using FormData . For example. One submission did this: data: form.serialize() while the other did: var formData = new FormData($('form')[0]); data: formData So what is the difference between FormData and .serialize() ? 回答1: The main difference from a usage standpoint is that you can't serialize files, only file names....the value of a file input. FormData

FormData() object does not add submit-type inputs from form, while on Firefox

雨燕双飞 提交于 2019-12-03 06:39:41
Today I came across an interesting bug, which took a good chunk of time to get to the bottom of. The setup A form on a page. On submit, the data gets captured and new FormData() object gets created with it. That object gets sent with and xhr request to an .php script, which then returns an ok / error message. The code looks something like this: ( simplified version, no need for fluff ) <form name="frm" id="frm" action="" method="post" onsubmit="save(event, this);" enctype="multipart/form-data"> <input name="name" id="name" type="text" value="..." /> <input name="email" id="email" type="text"

Error: invalid json with multer and body-parser

落花浮王杯 提交于 2019-12-03 03:35:19
I am currently using multer for multipart/form-data in node.js application alongside with body-parser . I tried to POST form-data using POSTMAN, but it is getting this error. Error: invalid json at parse (/Users/k/Documents/application/node_modules/body-parser/lib/types/json.js:79:15) at /Users/k/Documents/application/node_modules/body-parser/lib/read.js:102:18 at IncomingMessage.onEnd (/Users/k/Documents/application/node_modules/body-parser/node_modules/raw-body/index.js:136:7) at IncomingMessage.g (events.js:199:16) at IncomingMessage.emit (events.js:104:17) at _stream_readable.js:908:16 at

formData object not working with jquery AJAX post?

╄→гoц情女王★ 提交于 2019-12-03 02:21:58
lets jump right into the code : var formData = new FormData(); formData.append('name', dogName); formData.append('weight', dogWeight); formData.append('activity', dogActivity); formData.append('age', dogAge); formData.append('file', document.getElementById("dogImg").files[0]); console.log(formData); Here I am appending some strings and one file object to the formData object in order to send all the information asynchronous to the server. Right after that I have this jquery ajax request : $.ajax({ type: "POST", url: "/foodoo/index.php?method=insertNewDog", data: formData, processData: false,

Send XMLHttpRequest with both Header and FormData

谁说胖子不能爱 提交于 2019-12-02 10:31:32
问题 I am trying to send a XMLHttpRequest with a header and add a FormData. Is there an (elegant) way i can do something like this: var formData = new FormData(); formData.append("file", file); var xhr = new XMLHttpRequest(); xhr.open("POST", "/ajax_gateway.php?mod=fileupload", true); xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded") xhr.send(formData, "token=add"); 回答1: You cannot specify the Content-Type header when sending FormData because that header automatically gets

Column in extended table are not presented in form data on Eclipse Scout

为君一笑 提交于 2019-12-02 09:39:44
I have Table field as Templates. For this Table field I have form data created with anotation @FormData(value = AbstractMyTableData.class, sdkCommand = FormData.SdkCommand.USE, defaultSubtypeSdkCommand = FormData.DefaultSubtypeSdkCommand.CREATE) public abstract class MyTableField extends AbstractTableField<MyTableField.Table> Inside MyTableField.Table I have n column and all of them is presented in form data for this field, so I can add rows like : int rowNum = formData.addRow(); formData.setColumn_1(rowNumber, value); .... formData.setColumn_n(rowNumber, value); Now I want to extend my table