我正在用 c# 处理文件发布。我使用 ajax 从客户端发布了一个文件,代码如下
<script type="text/javascript">
function send() {
var fd = new FormData();
fd.append("fileToUpload", document.getElementById('filecontrol').files[0]);
var xhr = new XMLHttpRequest();
xhr.open("POST", "getFile.aspx");
xhr.send(fd);
}
</script>
<input type="file" id="filecontrol" />
<input type="button" onclick="getFile()" value="Upload File" />
在服务器端,我使用代码检索了该文件,
HttpPostedFile hpf = Request.Files[0];
我需要使用 http post 将此文件发送到另一个域。是否可以使用 http post 发送该 hpf?