我四处搜寻,找不到问题的答案。我已经尝试了很多东西但它没有用。
每当我通过XMLHttpRequest将文件发送到我的swfupload.php时,我的swfupload.php都看不到$_FILES
这是我的HTML
<form id="FlashUpload">
<div class="fUpload">
<label for="fileToUpload">Select a swf to Upload</label><br />
<input type="file" name="upfile" id="fileToUpload" onchange="fileSelected();" accept="application/x-shockwave-flash">
<input type="button" value="Upload" id="buttonToUpload" onclick="uploadFlash();"/>
<div id="fError"></div>
</div>
<div style=" display:none;" class="meter animate">
<span style="width: 0%;"><span></span></span>
</div>
</form>
这是我的javascript文件
function uploadFlash() {
var client = new XMLHttpRequest();
var file = document.getElementById('fileToUpload');
var formData = new FormData();
formData.append("upfile", file.files[0]);
client.open("post", "/swfupload.php", true);
client.setRequestHeader("Content-Type", "multipart/form-data");
client.send(file); /* Send to server */
client.onreadystatechange = function()
{
if (client.readyState === 4 && client.status === 200) {
var return_data = client.responseText;
$("#fError").text(return_data);
}
}
}
这是我在PHP中出现错误的部分
if (!isset($_FILES['upfile']['error'])) {
throw new RuntimeException($_FILES['upfile']['error']);
}
我不确定这与我在WAMP中有什么关系
错误: