form-data

FormData not working in Internet Explorer?

半腔热情 提交于 2019-12-19 21:24:23
问题 function uploadPhoto(file) { if (!file || !file.type.match(/image.*/)){ if(!file){ postStatus(); } else { return; } } var fd = new FormData(); fd.append("image", file); fd.append("privacy", document.getElementById('privacy-handler').value); var xhr = GetXmlHttpRequest(); xhr.open("POST", "url here"); slideUp('photo-upload'); slideDown('photo-manager-txt'); document.getElementById("photo-manager-txt").innerHTML='<i>Please wait a moment while we process your photo.</i>'; xhr.onload = function()

How can retrieve string formData js in c#

北城余情 提交于 2019-12-19 03:22:23
问题 I have to retrieve the value of "idPerson" in my web api in .net. I already retrieve the file "UploadedImage". But I can't retrieve the value of "idPerson". Someone have a solution? Thx ! my js function /** * Upload de l'image de profil * @method uploadFile * @private */ uploadFile: function () { var data = new FormData(), files, ajaxRequest; files = $("#fileUpload").get(0).files; // Ajout de l'image uploadé vers les données du form if (files.length > 0) { data.append("UploadedImage", files[0

Angular Passing FormData to WebAPI. Getting null

为君一笑 提交于 2019-12-17 20:32:28
问题 I am passing FormData object from Angular 7 to WebAPI but I getting a null Any help is appreciated. Thanks From typescript, i have selectFile(event){ if (event.target.files[0]) { this.blob = event.target.files[0]; } } save() { let formDataDTO = new FormData(); formDataDTO.append('file', this.blob, this.fileName); this.http.post<T>(this.url, JSON.stringify(formDataDTO), this.getHeaders()) .pipe( catchError(error => { })) } In WebAPI, [HttpPost] [Route("file/add")] public HttpResponseMessage

Uploading multiple files asynchronously by blueimp jquery-fileupload

本秂侑毒 提交于 2019-12-17 09:57:47
问题 I'm using jQuery File Upload library (http://github.com/blueimp/jQuery-File-Upload), and I've been stuck figuring out how to use the library satisfying the following conditions. The page has multiple file input fields surrounded by a form tag. Users can attach multiple files to each input field All files are sent to a server when the button is clicked, not when files are attached to the input fields. Upload is done asynchronously Say the page has 3 input fields with their name attributes

Uploading multiple files asynchronously by blueimp jquery-fileupload

感情迁移 提交于 2019-12-17 09:56:40
问题 I'm using jQuery File Upload library (http://github.com/blueimp/jQuery-File-Upload), and I've been stuck figuring out how to use the library satisfying the following conditions. The page has multiple file input fields surrounded by a form tag. Users can attach multiple files to each input field All files are sent to a server when the button is clicked, not when files are attached to the input fields. Upload is done asynchronously Say the page has 3 input fields with their name attributes

Node.JS: How to send headers with form data using request module

北慕城南 提交于 2019-12-17 08:16:33
问题 I have code like the following: var req = require('request'); req.post('someUrl', { form: { username: 'user', password: '', opaque: 'someValue', logintype: '1'}, }, function (e, r, body) { console.log(body); }); How can I set headers for this? I need user-agent, content-type and probably something else to be in the headers: headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36', 'Content-Type' : 'application/x

How to give a Blob uploaded as FormData a file name?

拈花ヽ惹草 提交于 2019-12-17 07:02:16
问题 I am currently uploading images pasted from the clipboard with the following code: // Turns out getAsFile will return a blob, not a file var blob = event.clipboardData.items[0].getAsFile(), form = new FormData(), request = new XMLHttpRequest(); form.append("blob",blob); request.open( "POST", "/upload", true ); request.send(form); Turns out the uploaded form field with receive a name similar to this: Blob157fce71535b4f93ba92ac6053d81e3a Is there any way to set this or receive this file name

How to make POST requests with the FormData API

旧城冷巷雨未停 提交于 2019-12-17 05:15:12
问题 I want to pass the username and form_data object to the php file using http.post when i pass only form_data it works my picture upload. but i want to pass some other information like username as well. please help me how to pass other data in http.post And here is my php file. <?php include "connectdb.php"; $data=json_decode(file_get_contents("php://input")); $name=$dbhandle->real_escape_string($data->susername); if (!empty($_FILES)) { $date=2; $path = 'fooditem/'. $_FILES['file']['name']; if

How to make POST requests with the FormData API

天涯浪子 提交于 2019-12-17 05:15:04
问题 I want to pass the username and form_data object to the php file using http.post when i pass only form_data it works my picture upload. but i want to pass some other information like username as well. please help me how to pass other data in http.post And here is my php file. <?php include "connectdb.php"; $data=json_decode(file_get_contents("php://input")); $name=$dbhandle->real_escape_string($data->susername); if (!empty($_FILES)) { $date=2; $path = 'fooditem/'. $_FILES['file']['name']; if

FormData.append(“key”, “value”) is not working

随声附和 提交于 2019-12-17 03:49:38
问题 Can you tell me whats wrong with this: var formdata = new FormData(); formdata.append("key", "value"); console.log(formdata); My output looks like this, I cant find my "key" - "value" pair FormData *__proto__: FormData **append: function append() { [native code] } ***arguments: null ***caller: null ***length: 0 ***name: "append" ***prototype: append ***__proto__: function Empty() {} *constructor: function FormData() { [native code] } **arguments: null **caller: null **length: 0 **name: