Помогите пожалуйсто не могу отправить фаил через javascript ((
<input id="foto_name" name="foto_name" type="file" />
<a href="javascript
:sendRequest(document.getElementBy Id('foto_name').value)"> Загрузить </a>
function sendRequest(sBody) {
var dFile = sBody;
var oXmlHttp = createXMLHttp();
oXmlHttp.open("POST",'mod/mod_gallery/load_image.php', true);
oXmlHttp.setRequestHeader("Content-Type", "multipart/form-data");
oXmlHttp.onreadystatechange = function() {
if(oXmlHttp.readyState == 4) {
if(oXmlHttp.status == 200) {
saveResult(oXmlHttp.responseText);
} else {
saveResult("Ошибка: " + oXmlHttp.statusText);
}
}
};
oXmlHttp.send(dFile);
}
function saveResult(sText) {
alert(sText);
}