I have an webDav CORS plugin, which I can use to POST/PUT/GET/REMOVE/ALLDOCS files on a webDav server.
I now want to do the same for FTP, but I'm struggling to get the xmlhttprequest
-syntax to work (I'm just getting error 0
).
This page on Mozilla says it's possible to use xmlhttprequests
for file and ftp as well, but I cannot find a working example or tutorial anywhere.
This is what I'm trying, which returns access to restricted URI denied
function reqListener () {
console.log(this.responseText);
}
var oReq = new XMLHttpRequest();
oReq.onload = reqListener;
oReq.open("GET", "ftp://<username>:<passeword>@mydomain.de/folder/test.txt", true);
oReq.send();
I also tried a regular Ajax request
$.ajax({
url: "ftp://sharedspace.domain.provider.com/folder/test.txt",
type: "GET",
async: true,
dataType: "text",
crossdomain : true,
headers : {
user: "<username>",
password: "<password>"
},
success: function(e){
console.log("success");
console.log(e);
},
error: function(e){
console.log("error");
console.log(e);
},
});
which also does not work, returning 0
status code.
Question:
What is the correct syntax to do a cross-domain XMLHTTPREQUEST
for FTP
.
Thanks!
EDIT:
The only useful link I found is this page here, but it's just bits and pieces of information and I couldn't puzzle them together.
EDIT
Maybe also useful link
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…