form-data

append files to FormData not work in angularjs

吃可爱长大的小学妹 提交于 2019-12-08 04:18:16
问题 I use angularjs to upload files and json object to nodejs server in single request. Then I get this console.log on firebug: -----------------------------8791641017658 Content-Disposition: form-data; name="model" {"phone":"asasasa","description":"121212112","payment":"2121212121","shipping":"121221221","imageurl":"21212112","price":"212112212","status":"new"} -----------------------------8791641017658-- So, the name="file" does not appear here. And the console.log(req.files) in nodejs server /

Failed to load resource: net::ERR_FILE_NOT_FOUND uploading files bigger than 500Mb

馋奶兔 提交于 2019-12-07 22:42:46
问题 I have a problem uploading files bigger than 500Mb. I created a plunker file with error code: https://plnkr.co/edit/vKHNkUuVX1RrMcZ6Ezhc?p=preview var request = new XMLHttpRequest(); request.open("POST", "/uploadFile"); request.send(formData); request.addEventListener("progress", function(evt) { if (evt.lengthComputable) { console.log(evt.loaded / evt.total); } else { console.log('Undefined percent...'); } }, false); request.addEventListener("load", function(evt) { console.error(evt); },

Submitting multiple inputs with same name

爱⌒轻易说出口 提交于 2019-12-07 15:15:47
问题 Ok, so I have form for creating polls. I want to use AJAX request and able user to attach image instead of question, so I use FormData for this. I could't find any solution for working with multiple input with same name (named like this: "name[]"). I tried this option: var fdata = new FormData(); fdata.append('answers[]', $('input[name="answer[]"]').val()); But it doesn't work. I know I could use .each() , but I don't want different name for each question, so I don't have to rebuild PHP side

How to append files in input type file with multiple before uploading [closed]

怎甘沉沦 提交于 2019-12-06 22:40:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I select 2 images and again I select 3 images second time before upload, the first two gets removed from input type file and last 3 images are still there. I know it's the default behavior of input type file, that it replaces the new files with new selected ones, but I want to keep

formData.has() is not a function [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-06 14:56:29
This question already has an answer here : FormData.get function is undefined (1 answer) Closed 3 years ago . I'm trying to do a simple ajax file upload, but I'm getting an "Uncaught TypeError: formData.has is not a function" If I also comment out the formData.has() checking function and just replace it with formData.append('myResume'), I get a similar error that says formData.get() is not a function in my ajax call. Any suggestions? Thanks :) Here's the html: <div id="upload"> <form id="file-form" name="resume.pdf"> <input type="file" id="file-select"/> <button type="submit" id="upload-button

Sending nested JSON with image

无人久伴 提交于 2019-12-06 13:34:10
问题 I have been trying to research a way to be able to send nested JSON requests via Ajax back to the server. From my understanding formdata that we mostly use for sending images or files to the server wont work in this scenario, since it seems like FormData does not handle nested objects. This is the kind of payload I need to send. Any suggestions? payload = { 'login':{ 'key':'some_key' }, 'user':{ 'doc':{ 'dp':<here will be the image file>, 'date':"some date", 'extra':"extra info" },

Failed to load resource: net::ERR_FILE_NOT_FOUND uploading files bigger than 500Mb

廉价感情. 提交于 2019-12-06 08:06:16
I have a problem uploading files bigger than 500Mb. I created a plunker file with error code: https://plnkr.co/edit/vKHNkUuVX1RrMcZ6Ezhc?p=preview var request = new XMLHttpRequest(); request.open("POST", "/uploadFile"); request.send(formData); request.addEventListener("progress", function(evt) { if (evt.lengthComputable) { console.log(evt.loaded / evt.total); } else { console.log('Undefined percent...'); } }, false); request.addEventListener("load", function(evt) { console.error(evt); }, false); request.addEventListener("error", function(evt) { console.error(evt); }, false); To reproduce the

Sending Audio Blob to server

大兔子大兔子 提交于 2019-12-06 06:34:19
I am trying to send an audio blob produced by WebAudio API and Recorder.js to my Laravel Controller using jQuery's $.post method. Here is what I am trying. $('#save_oralessay_question_btn').click(function(e){ var question_content = $('#question_text_area').val(); var test_id_fr = parseInt($('#test_id_fr').val()); var question_type = parseInt($('#question_type').val()); var rubric_id_fr = $('#rubric_id_fr').val(); var reader = new FileReader(); reader.onload = function(event){ var form_data = new FormData(); form_data.append('audio_data', event.target.result); var result = $.post('../questions'

How to send a buffer in form-data to SignServer?

Deadly 提交于 2019-12-06 05:11:11
问题 I have a file in memory (in a buffer), it doesn't exist on the file system (so I can't just stream that). I'm trying to send it to SignServer using HTTP. Here's how I try to do it: var formdata = require('form-data'); var form = new formdata(); form.append('workerName', 'PDFSigner'); form.append('data', file_buffer); // or // escape(file_buffer.toString('binary')) // or // file_buffer.toString('binary') (without escaping) var request = form.submit('http://localhost:8080/signserver/process',

How to send Array with the formdata in ajax request to mvc action

谁说胖子不能爱 提交于 2019-12-06 03:37:48
问题 I was trying to send array with the form data to an action with Ajax request but whenever I do I receive both the form data and the array empty $scope.SubmitForm = function () { var sLangs = $("#supportedLanguages").data("kendoMultiSelect").value(); var formdata = new FormData($('#frmAppSettings').get(0)); alert(formdata.SelectedLanguages); var data = new FormData(document.getElementById("frmAppSettings")); $.ajax({ type: "POST", url: "/AppMenuMaker/AppSettings", data: JSON.stringify({