XMLHttpRequest post 传递多个参数及服务器端读取
一直没搞定XMLHttpRequest post方法如何传递多种参数,比如同时读取post参数和file参数
var http = new XMLHttpRequest();
var form = new FormData();
// Add selected file to form
form.append(me.getName(), file);
form.append('filename', '1.png');
// Send form with file using XMLHttpRequest POST request
http.open('POST', me.getUrl());
http.send(form);
服务器端
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
$uploadfile = $uploaddir . basename($_POST['filename']);