Reputation:
I am working with file posting in c#. I have posted a file from client side using ajax, with the following code
<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" />
and in the server side, i retrieved that file using the code,
HttpPostedFile hpf = Request.Files[0];
I need to send this file to another domain using http post. Is it possible to send that hpf using http post?.
Upvotes: 1
Views: 5497
Reputation: 1447
I think you should be able to do that. There are many ways to do that. here is a link Upload files with HTTPWebrequest (multipart/form-data)
Upvotes: 1